annotate src/away.c @ 6106:99f4bbeb27bc

[gaim-migrate @ 6567] Fix Cae non-fatal bug 6: "no notification of incorrect password/name." Also removed some unused code from gtkconn.c and multi.c (which was derelict). Make dialog and request windows show the titles that are passed to them. Fixed a compiler warning coughsean'sawaymessagestuffcough I'm looking forward to writting a NEWS entry for 0.65, I hope it will be soon :-) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 13 Jul 2003 09:34:48 +0000
parents 272c761c52e3
children dc42b27101c0
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
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
19 *
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
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: 5676
diff changeset
23 #include "conversation.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
24 #include "debug.h"
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
25 #include "plugin.h"
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
26 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
27 #include "prpl.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
28 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
29
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
30 /* XXX Until we can get rid of the message queue stuff... */
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
31 #include "gaim.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
32
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
33 #include "gtkblist.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
34 #include "gtkimhtml.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
35 #include "gtkprefs.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
36 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
37 #include "ui.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
39 GtkWidget *imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
41 GtkWidget *awaymenu = NULL;
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
42 GtkWidget *awayqueue = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
43 GtkListStore *awayqueuestore = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
44 GtkWidget *awayqueuesw;
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
45
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 struct away_message *awaymessage = NULL;
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
47 struct away_message *default_away;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
48 int auto_away;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 static void destroy_im_away()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 if (imaway)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 gtk_widget_destroy(imaway);
1774
9d0c91c705b7 [gaim-migrate @ 1784]
Rob Flynn <gaim@robflynn.com>
parents: 1773
diff changeset
54
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
55 awayqueue = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
56 g_object_unref(G_OBJECT(awayqueuestore));
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
57 awayqueuestore = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
58 awayqueuesw = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
59 imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
62 static void dequeue_message(GtkTreeIter *iter)
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
63 {
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
64 gchar *name;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
65 GSList *templist;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5593
diff changeset
66 GaimConversation *cnv;
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
67
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
68 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
69
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
70 gaim_debug(GAIM_DEBUG_INFO, "away", "Unqueueing messages from %s.\n",
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
71 name);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
72
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
73 templist = message_queue;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
74
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
75 while (templist) {
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
76 struct queued_message *qm = templist->data;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
77 if (templist->data) {
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4727
diff changeset
78 if (!gaim_utf8_strcasecmp(qm->name, name)) {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
79 GaimAccount *account = NULL;
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
80
5580
86456ec3ca25 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
81 if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0)
4608
5fcb44d771d2 [gaim-migrate @ 4896]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
82 account = qm->account;
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
83
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
84 cnv = gaim_find_conversation(name);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
85
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
86 if (!cnv)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
87 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name);
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
88 else
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
89 gaim_conversation_set_account(cnv, account);
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
90
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
91 gaim_im_write(GAIM_IM(cnv), NULL, qm->message, qm->len,
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
92 qm->flags, qm->tm);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
93 g_free(qm->message);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
94 g_free(qm);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
95 templist = message_queue = g_slist_remove(message_queue, qm);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
96
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
97 } else {
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
98 templist = templist->next;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
99 }
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
100 }
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
101 }
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
102
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
103 g_free(name);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
104 /* In GTK 2.2, _store_remove actually returns whether iter is valid or not
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
105 * after the remove, but in GTK 2.0 it is a void function. */
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
106 gtk_list_store_remove(awayqueuestore, iter);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
107 }
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
108
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
109 void purge_away_queue(GSList **queue)
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
110 {
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
111 GSList *q = *queue;
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
112 struct queued_message *qm;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5593
diff changeset
113 GaimConversation *cnv;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
114 GaimAccount *account;
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
115
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
116 while (q) {
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
117 qm = q->data;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
118
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
119 account = NULL;
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
120
5580
86456ec3ca25 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
121 if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0)
4608
5fcb44d771d2 [gaim-migrate @ 4896]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
122 account = qm->account;
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
123
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4274
diff changeset
124 cnv = gaim_find_conversation(qm->name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4274
diff changeset
125
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
126 if (!cnv)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
127 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name);
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4412
diff changeset
128 else
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
129 gaim_conversation_set_account(cnv, account);
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
130
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4274
diff changeset
131 gaim_im_write(GAIM_IM(cnv), NULL, qm->message, -1, qm->flags, qm->tm);
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
132
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
133 g_free(qm->message);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
134 g_free(qm);
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
135
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
136 q->data = NULL;
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
137 q = q->next;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
138 }
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
139
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
140 g_slist_free(*queue);
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
141 *queue = NULL;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
142 }
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
143
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
144 gint dequeue_cb(GtkWidget *treeview, GdkEventButton *event, gpointer data) {
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
145 GtkTreeIter iter;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
146 GtkTreeSelection *select;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
147
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
148 if(!(event->type == GDK_2BUTTON_PRESS && event->button == 1))
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
149 return FALSE; /* Double clicking on the list will unqueue that user's messages. */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
150
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
151 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
152 if(gtk_tree_selection_get_selected(select, NULL, &iter))
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
153 dequeue_message(&iter);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4274
diff changeset
154
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
155 return FALSE;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
156 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4476
diff changeset
157
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
158
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
159
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
160 void toggle_away_queue()
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
161 {
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
162 if (!awayqueue || !awayqueuesw)
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
163 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
164
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
165 if (gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) {
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
166 gtk_widget_show(awayqueue);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
167 gtk_widget_show(awayqueuesw);
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
168 } else {
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
169 gtk_widget_hide(awayqueue);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
170 gtk_widget_hide(awayqueuesw);
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
171 purge_away_queue(&message_queue);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
172 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
173 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
174
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175 void do_im_back(GtkWidget *w, GtkWidget *x)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177 if (imaway) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
178 GtkWidget *tmp = imaway;
1768
9aae465eeb6e [gaim-migrate @ 1778]
Rob Flynn <gaim@robflynn.com>
parents: 1726
diff changeset
179
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
180 purge_away_queue(&message_queue);
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
181
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
182 imaway = NULL;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
183 gtk_widget_destroy(tmp);
1614
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
184 if (w != tmp)
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
185 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
186 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
188 while (away_time_queue) {
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
189 struct queued_away_response *qar = away_time_queue->data;
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
190 away_time_queue = g_slist_remove(away_time_queue, qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
191 g_free(qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
192 }
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
193
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 awaymessage = NULL;
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
195 awayqueue = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
196 awayqueuesw = NULL;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
197 g_object_unref(G_OBJECT(awayqueuestore));
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
198 awayqueuestore = NULL;
3514
b1ebeecfd2aa [gaim-migrate @ 3586]
Luke Schierer <lschiere@pidgin.im>
parents: 3474
diff changeset
199 serv_set_away_all(NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
200 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
201
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
202
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 void do_away_message(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
205 GtkWidget *back;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
206 GtkWidget *awaytext;
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
207 GtkWidget *sw;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
208 GtkWidget *vbox;
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
209 GtkTreeViewColumn *column;
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
210 GtkCellRenderer *renderer;
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
211 char *buf;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
212
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
213 if (!a)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
214 return;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
215
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
216 if (!imaway) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
217 GAIM_DIALOG(imaway);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 3956
diff changeset
218 gtk_window_set_role(GTK_WINDOW(imaway), "imaway");
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
219 if (strlen(a->name))
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
220 gtk_window_set_title(GTK_WINDOW(imaway), a->name);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
221 else
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
222 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
223 g_signal_connect(G_OBJECT(imaway), "destroy",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
224 G_CALLBACK(do_im_back), imaway);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
225 gtk_widget_realize(imaway);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
226
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
227 vbox = gtk_vbox_new(FALSE, 5);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
228 gtk_container_add(GTK_CONTAINER(imaway), vbox);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
229 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
230 gtk_widget_show(vbox);
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
231
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
232 sw = gtk_scrolled_window_new(NULL, NULL);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
233 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER,
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
234 GTK_POLICY_ALWAYS);
3929
f0efc0293bbf [gaim-migrate @ 4101]
Rob Flynn <gaim@robflynn.com>
parents: 3922
diff changeset
235 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
236 gtk_widget_set_size_request(sw, 245, 120);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
237 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
238 gtk_widget_show(sw);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
239
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
240 awaytext = gtk_imhtml_new(NULL, NULL);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
241 gtk_container_add(GTK_CONTAINER(sw), awaytext);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
242 gaim_setup_imhtml(awaytext);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
243 gtk_widget_show(awaytext);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
244 buf = stylize(a->message, BUF_LONG);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
245 gtk_imhtml_append_text(GTK_IMHTML(awaytext), buf, -1, GTK_IMHTML_NO_TITLE |
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
246 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
247 g_free(buf);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
248 gtk_imhtml_append_text(GTK_IMHTML(awaytext), "<BR>", -1, GTK_IMHTML_NO_TITLE |
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
249 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
250
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
251 awayqueuesw = gtk_scrolled_window_new(NULL, NULL);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
252 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(awayqueuesw), GTK_POLICY_NEVER,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
253 GTK_POLICY_AUTOMATIC);
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
254 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(awayqueuesw),
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
255 GTK_SHADOW_IN);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
256 gtk_box_pack_start(GTK_BOX(vbox), awayqueuesw, TRUE, TRUE, 0);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
257
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
258 awayqueuestore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
259 awayqueue = gtk_tree_view_new_with_model(GTK_TREE_MODEL(awayqueuestore));
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
260 renderer = gtk_cell_renderer_text_new();
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
261
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
262 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(awayqueue), FALSE);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
263 column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
264 "text", 0,
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
265 NULL);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
266 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
267 column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
268 "text", 1,
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
269 NULL);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
270 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
271
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
272 gtk_container_add(GTK_CONTAINER(awayqueuesw), awayqueue);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
273
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
274 g_signal_connect(G_OBJECT(awayqueue), "button_press_event", G_CALLBACK(dequeue_cb), NULL);
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
275
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
276
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
277 if (gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) {
4412
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
278 gtk_widget_show(awayqueuesw);
8067614e49e4 [gaim-migrate @ 4685]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
279 gtk_widget_show(awayqueue);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
280 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
281
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
282 back = gaim_pixbuf_button_from_stock(_("I'm Back!"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
283 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
284 g_signal_connect(G_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
285 gtk_window_set_focus(GTK_WINDOW(imaway), back);
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
286 gtk_widget_show(back);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
287
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 awaymessage = a;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
289 } else {
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
290 destroy_im_away();
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
291 do_away_message(w, a);
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
292 return;
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
293 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
295 /* New away message... Clear out the old sent_aways */
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
296 while (away_time_queue) {
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
297 struct queued_away_response *qar = away_time_queue->data;
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
298 away_time_queue = g_slist_remove(away_time_queue, qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
299 g_free(qar);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
300 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301
1779
0da2a831c0ae [gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1775
diff changeset
302 gtk_widget_show(imaway);
6019
272c761c52e3 [gaim-migrate @ 6469]
Sean Egan <seanegan@gmail.com>
parents: 5872
diff changeset
303 serv_set_away_all(awaymessage->message);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
304 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306 void rem_away_mess(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
308 int default_index;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
309 default_index = g_slist_index(away_messages, default_away);
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
310 if (default_index == -1) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
311 if (away_messages != NULL)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
312 default_away = away_messages->data;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
313 else
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
314 default_away = NULL;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
315 }
1306
868f9c98db13 [gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1292
diff changeset
316 away_messages = g_slist_remove(away_messages, a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
317 g_free(a);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
318 do_away_menu();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
321 static void set_gc_away(GObject *obj, GaimConnection *gc)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
322 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
323 struct away_message *awy = g_object_get_data(obj, "away_message");
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
324
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
325 if (awy)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
326 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
327 else
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
328 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
329 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
330
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
331 static void set_gc_state(GObject *obj, GaimConnection *gc)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
332 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
333 char *awy = g_object_get_data(obj, "away_state");
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
334
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
335 serv_set_away(gc, awy, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
336 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
338 /* XXX This needs to be fixed, NOW! */
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
339 extern GtkListStore *prefs_away_store;
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
340 extern GtkWidget *prefs_away_menu;
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
341
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 void do_away_menu()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344 GtkWidget *menuitem;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
345 GtkWidget *remmenu;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
346 GtkWidget *submenu, *submenu2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
347 GtkWidget *remitem;
5160
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
348 GtkWidget *image;
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
349 GdkPixbuf *pixbuf, *scale;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350 GList *l;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
351 GSList *awy = away_messages;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
352 struct away_message *a;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
353 GList *con;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
354 GaimConnection *gc = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
355 GaimPluginProtocolInfo *prpl_info = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
356
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
357 int count = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
359 if (prefs_away_store != NULL) {
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
360 gtk_list_store_clear(prefs_away_store);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
361 while (awy) {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
362 GtkTreeIter iter;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 a = (struct away_message *)awy->data;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
364 gtk_list_store_append(prefs_away_store, &iter);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
365 gtk_list_store_set(prefs_away_store, &iter,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
366 0, a->name,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
367 1, a,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
368 -1);
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 939
diff changeset
369 awy = g_slist_next(awy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
372
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
373 if (awaymenu) {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
374 l = gtk_container_get_children(GTK_CONTAINER(awaymenu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
375
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
376 while (l) {
1530
0b6e4d52de63 [gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
377 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
378 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
379 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
382 remmenu = gtk_menu_new();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
384 menuitem = gtk_menu_item_new_with_label(_("New Away Message"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
385 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
386 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
387 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(create_away_mess),
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
388 NULL);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
389
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
390 awy = away_messages;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
391 while (awy) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
392 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
393
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
394 remitem = gtk_menu_item_new_with_label(a->name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
395 gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), remitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
396 gtk_widget_show(remitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
397 g_signal_connect(G_OBJECT(remitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
398 G_CALLBACK(rem_away_mess), a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
399
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
400 awy = g_slist_next(awy);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
401
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
402 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
403
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
404 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
405 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406 gtk_widget_show(menuitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
407 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
408 gtk_widget_show(remmenu);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
409
5160
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
410 gaim_separator(awaymenu);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
411
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
412 for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
413 gc = con->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
414
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
415 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
416
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
417 if (prpl_info->away_states != NULL && prpl_info->set_away != NULL)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
418 count++;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
419 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
420
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
421 if (count == 0) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
422 } else if (count == 1) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
423 GList *msgs, *tmp;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
424
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
425 for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
426 gc = con->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
427
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
428 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
429
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
430 if (prpl_info->away_states && prpl_info->set_away)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
431 break;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
432 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
433
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
434 tmp = msgs = prpl_info->away_states(gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
435
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
436 if ((g_list_length(msgs) == 1) && !strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
437 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
438
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
439 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
440 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
441
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
442 menuitem = gtk_menu_item_new_with_label(a->name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
443 g_object_set_data(G_OBJECT(menuitem), "away_message", a);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
444 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
445 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
446 g_signal_connect(G_OBJECT(menuitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
447 G_CALLBACK(do_away_message), a);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
448
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
449 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
450 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
451 } else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
452 while (msgs) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
453 awy = away_messages;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
454
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
455 menuitem = gtk_menu_item_new_with_label(msgs->data);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
456 g_object_set_data(G_OBJECT(menuitem), "away_state", msgs->data);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
457 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
458 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
459
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
460 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
461 g_signal_connect(G_OBJECT(menuitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
462 G_CALLBACK(set_gc_state), gc);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
463 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
464 submenu = gtk_menu_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
465 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
466 submenu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
467 gtk_widget_show(submenu);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
468
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
469 while (awy) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
470 a = (struct away_message *)awy->data;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
471
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
472 menuitem = gtk_menu_item_new_with_label(a->name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
473 g_object_set_data(G_OBJECT(menuitem), "away_message",
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
474 a);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
475 gtk_menu_shell_append(GTK_MENU_SHELL(submenu),
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
476 menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
477 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
478 g_signal_connect(G_OBJECT(menuitem),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
479 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
480 G_CALLBACK
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
481 (do_away_message), a);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
482
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
483 awy = g_slist_next(awy);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
484 }
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
485 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
486 msgs = g_list_next(msgs);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
487 }
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
488
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
489 g_list_free(tmp);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
490 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
491 else {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
492 for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
493 GaimAccount *account;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
494 char buf[256];
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
495 GList *msgs, *tmp;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
496 gc = con->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
497
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
498 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
499
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
500 if (!prpl_info->away_states || !prpl_info->set_away)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
501 continue;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
502
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
503 account = gaim_connection_get_account(gc);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
504
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
505 g_snprintf(buf, sizeof(buf), "%s (%s)",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
506 gaim_account_get_username(account), gc->prpl->info->name);
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
507 menuitem = gtk_image_menu_item_new_with_label(buf);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
508
5160
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
509 pixbuf = create_prpl_icon(gc->account);
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
510 if (pixbuf) {
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
511 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
512 image = gtk_image_new_from_pixbuf(scale);
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
513 g_object_unref(G_OBJECT(pixbuf));
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
514 g_object_unref(G_OBJECT(scale));
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
515 gtk_widget_show(image);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
516 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5160
diff changeset
517 image);
5160
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
518 }
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
519
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
520 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
521 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
522
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
523 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
524 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
525 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
526
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
527 tmp = msgs = prpl_info->away_states(gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
528
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
529 if ((g_list_length(msgs) == 1) &&
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
530 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) {
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
531 menuitem = gtk_menu_item_new_with_label(_("Back"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
532 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
533 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
534 g_signal_connect(G_OBJECT(menuitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
535 G_CALLBACK(set_gc_away), gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
536
5160
91ea5ef2278b [gaim-migrate @ 5524]
Mark Doliner <mark@kingant.net>
parents: 5024
diff changeset
537 gaim_separator(submenu);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
538
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
539 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
540
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
541 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
542 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
543
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
544 menuitem = gtk_menu_item_new_with_label(a->name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
545 g_object_set_data(G_OBJECT(menuitem), "away_message", a);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
546 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
547 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
548 g_signal_connect(G_OBJECT(menuitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
549 G_CALLBACK(set_gc_away), gc);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
550
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
551 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
552 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
553 } else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
554 while (msgs) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
555 awy = away_messages;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
556
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
557 menuitem = gtk_menu_item_new_with_label(msgs->data);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
558 g_object_set_data(G_OBJECT(menuitem), "away_state",
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
559 msgs->data);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
560 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
561 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
562
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
563 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
564 g_signal_connect(G_OBJECT(menuitem),
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
565 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
566 G_CALLBACK(set_gc_state),
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
567 gc);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
568 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
569 submenu2 = gtk_menu_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
570 gtk_menu_item_set_submenu(GTK_MENU_ITEM
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
571 (menuitem), submenu2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
572 gtk_widget_show(submenu2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
573
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
574 while (awy) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
575 a = (struct away_message *)awy->data;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
576
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
577 menuitem =
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
578 gtk_menu_item_new_with_label(a->
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
579 name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
580 g_object_set_data(G_OBJECT(menuitem),
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
581 "away_message", a);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
582 gtk_menu_shell_append(GTK_MENU_SHELL(submenu2),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
583 menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
584 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
585 g_signal_connect(G_OBJECT(menuitem),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
586 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
587 G_CALLBACK
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
588 (set_gc_away), gc);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
589
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
590 awy = g_slist_next(awy);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
591 }
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
592 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
593 msgs = g_list_next(msgs);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
594 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
595
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
596 g_list_free(tmp);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
597 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
598
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
599 menuitem = gtk_menu_item_new_with_label(_("Set All Away"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
600 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
601 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
602
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
603 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
604 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
605 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
606
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
607 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
608
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
609 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
610 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
611
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
612 menuitem = gtk_menu_item_new_with_label(a->name);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
613 g_object_set_data(G_OBJECT(menuitem), "away_message", a);
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
614 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
615 gtk_widget_show(menuitem);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
616 g_signal_connect(G_OBJECT(menuitem), "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
617 G_CALLBACK(do_away_message), a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
618
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
619 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
620 }
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
621 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
622 }
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
623
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
624 if (prefs_away_menu) {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
625 l = gtk_container_get_children(GTK_CONTAINER(prefs_away_menu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
626 while (l) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
627 gtk_widget_destroy(GTK_WIDGET(l->data));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
628 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
629 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
630 gtk_widget_hide(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
631 default_away_menu_init(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
632 gtk_widget_show(prefs_away_menu);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 }