annotate src/away.c @ 4225:76ea459c8b5b

[gaim-migrate @ 4469] Nicola's Lichtmaier (niqueco) thinks this fixes a leak, but wasn't sure. paco-paco agrees. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 07 Jan 2003 15:54:27 +0000
parents 7002b6f16bdf
children 906f61f27479
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 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
22 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1979
diff changeset
23 #include <config.h>
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
24 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include "gaim.h"
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
32 #include "prpl.h"
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
33 #include "gtkimhtml.h"
621
991bf4e3c9fe [gaim-migrate @ 631]
Todd Kulesza <fflewddur>
parents: 535
diff changeset
34 #include "pixmaps/join.xpm"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
36 GtkWidget *imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
38 GtkWidget *awaymenu = NULL;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
39 GtkWidget *clistqueue = NULL;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
40 GtkWidget *clistqueuesw;
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
41
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 struct away_message *awaymessage = NULL;
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
43 struct away_message *default_away;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
44 int auto_away;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 static void destroy_im_away()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 if (imaway)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 gtk_widget_destroy(imaway);
1774
9d0c91c705b7 [gaim-migrate @ 1784]
Rob Flynn <gaim@robflynn.com>
parents: 1773
diff changeset
50
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
51 clistqueue = NULL;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
52 clistqueuesw = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
53 imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
56 void purge_away_queue(GSList *queue)
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
57 {
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
58 struct conversation *cnv;
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
59
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
60 gtk_clist_freeze(GTK_CLIST(clistqueue));
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
61 gtk_clist_clear(GTK_CLIST(clistqueue));
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
62
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
63 while (queue) {
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
64 struct queued_message *qm = queue->data;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
65
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
66 cnv = find_conversation(qm->name);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
67 if (!cnv)
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
68 cnv = new_conversation(qm->name);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
69 if (g_slist_index(connections, qm->gc) >= 0)
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
70 set_convo_gc(cnv, qm->gc);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
71 write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
72
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
73 queue = g_slist_remove(queue, qm);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
74
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
75 g_free(qm->message);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
76 g_free(qm);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
77 }
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
78
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
79 gtk_clist_thaw(GTK_CLIST(clistqueue));
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
80 }
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
81
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
82 void dequeue_by_buddy(GtkWidget *clist, gint row, gint column, GdkEventButton *event, gpointer data) {
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
83 char *temp;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
84 char *name;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
85 GSList *templist;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
86 struct conversation *cnv;
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
87
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
88 if(!(event->type == GDK_2BUTTON_PRESS && event->button == 1))
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
89 return; /* Double clicking on the clist will unqueue that users messages. */
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
90
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
91 gtk_clist_get_text(GTK_CLIST(clist), row, 0, &temp);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
92 name = g_strdup(temp);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
93
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
94 if (!name)
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
95 return;
4124
19ee0409a3d7 [gaim-migrate @ 4341]
Luke Schierer <lschiere@pidgin.im>
parents: 4074
diff changeset
96 debug_printf("Unqueueing messages from %s.\n", name);
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
97 templist = message_queue;
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
98 while (templist) {
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
99 struct queued_message *qm = templist->data;
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
100 if (templist->data) {
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
101 if (!g_strcasecmp(qm->name, name)) {
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
102 cnv = find_conversation(name);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
103 if (!cnv)
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
104 cnv = new_conversation(qm->name);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
105 if (g_slist_index(connections, qm->gc) >= 0)
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
106 set_convo_gc(cnv, qm->gc);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
107
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
108 write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len);
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
109 g_free(qm->message);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
110 g_free(qm);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
111 templist = message_queue = g_slist_remove(message_queue, qm);
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
112
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
113 } else {
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
114 templist = templist->next;
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
115 }
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
116 }
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
117 }
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
118 g_free(name);
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
119 gtk_clist_remove(GTK_CLIST(clist), row);
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
120
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
121 }
4124
19ee0409a3d7 [gaim-migrate @ 4341]
Luke Schierer <lschiere@pidgin.im>
parents: 4074
diff changeset
122
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
123
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
124
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
125
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
126 void toggle_away_queue()
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
127 {
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
128 if (!clistqueue || !clistqueuesw)
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
129 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
130
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
131 if (away_options & OPT_AWAY_QUEUE) {
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
132 gtk_widget_show(clistqueue);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
133 gtk_widget_show(clistqueuesw);
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
134 } else {
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
135 gtk_widget_hide(clistqueue);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
136 gtk_widget_hide(clistqueuesw);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
137 purge_away_queue(message_queue);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
138 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
139 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
140
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 void do_im_back(GtkWidget *w, GtkWidget *x)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
142 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 if (imaway) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
144 GtkWidget *tmp = imaway;
1768
9aae465eeb6e [gaim-migrate @ 1778]
Rob Flynn <gaim@robflynn.com>
parents: 1726
diff changeset
145
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
146 purge_away_queue(message_queue);
1768
9aae465eeb6e [gaim-migrate @ 1778]
Rob Flynn <gaim@robflynn.com>
parents: 1726
diff changeset
147
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
148 imaway = NULL;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
149 gtk_widget_destroy(tmp);
1614
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
150 if (w != tmp)
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
151 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
152 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
154 while (away_time_queue) {
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
155 struct queued_away_response *qar = away_time_queue->data;
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
156 away_time_queue = g_slist_remove(away_time_queue, qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
157 g_free(qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
158 }
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
159
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160 awaymessage = NULL;
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
161 clistqueue = NULL;
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
162 clistqueuesw = NULL;
3514
b1ebeecfd2aa [gaim-migrate @ 3586]
Luke Schierer <lschiere@pidgin.im>
parents: 3474
diff changeset
163 serv_set_away_all(NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
166
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
167 void do_away_message(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
169 GtkWidget *back;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
170 GtkWidget *awaytext;
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
171 GtkWidget *sw;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
172 GtkWidget *vbox;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
173 char *buf2;
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
174 char *buf;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
176 if (!blist)
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
177 return;
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
178
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
179 if (!a)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
180 return;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
181
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
182 if (!imaway) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
183 GAIM_DIALOG(imaway);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 3956
diff changeset
184 gtk_window_set_role(GTK_WINDOW(imaway), "imaway");
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
185 if (strlen(a->name))
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
186 gtk_window_set_title(GTK_WINDOW(imaway), a->name);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
187 else
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
188 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
189 g_signal_connect(G_OBJECT(imaway), "destroy",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
190 G_CALLBACK(do_im_back), imaway);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
191 gtk_widget_realize(imaway);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
192
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
193 vbox = gtk_vbox_new(FALSE, 5);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
194 gtk_container_add(GTK_CONTAINER(imaway), vbox);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
195 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
196 gtk_widget_show(vbox);
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
197
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
198 sw = gtk_scrolled_window_new(NULL, NULL);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
199 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
200 GTK_POLICY_ALWAYS);
3929
f0efc0293bbf [gaim-migrate @ 4101]
Rob Flynn <gaim@robflynn.com>
parents: 3922
diff changeset
201 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
202 gtk_widget_set_usize(sw, 245, 120);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
203 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
204 gtk_widget_show(sw);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
205
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
206 awaytext = gtk_imhtml_new(NULL, NULL);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
207 gtk_container_add(GTK_CONTAINER(sw), awaytext);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
208 gaim_setup_imhtml(awaytext);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
209 gtk_widget_show(awaytext);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
210 buf = stylize(a->message, BUF_LONG);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
211 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
212 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
213 g_free(buf);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
214 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
215 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
216
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
217 clistqueuesw = gtk_scrolled_window_new(NULL, NULL);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
218 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clistqueuesw), GTK_POLICY_NEVER,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
219 GTK_POLICY_AUTOMATIC);
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
220 gtk_box_pack_start(GTK_BOX(vbox), clistqueuesw, TRUE, TRUE, 0);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
221
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
222 clistqueue = gtk_clist_new(2);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
223 gtk_clist_set_column_width(GTK_CLIST(clistqueue), 0, 100);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
224 gtk_widget_set_usize(GTK_WIDGET(clistqueue), -1, 50);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
225 gtk_container_add(GTK_CONTAINER(clistqueuesw), clistqueue);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
226 gtk_signal_connect(GTK_OBJECT(clistqueue), "select_row", GTK_SIGNAL_FUNC(dequeue_by_buddy), NULL);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
227
2573
fc54c1a070e7 [gaim-migrate @ 2586]
Rob Flynn <gaim@robflynn.com>
parents: 2501
diff changeset
228
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
229
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
230 if (away_options & OPT_AWAY_QUEUE) {
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
231 gtk_widget_show(clistqueuesw);
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
232 gtk_widget_show(clistqueue);
1773
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
233 }
6d1d9e988fd4 [gaim-migrate @ 1783]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
234
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
235 back = picture_button(imaway, _("I'm Back!"), join_xpm);
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
236 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
237 g_signal_connect(GTK_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238 gtk_window_set_focus(GTK_WINDOW(imaway), back);
1888
dedcd9e6f3e8 [gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
239
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
240 awaymessage = a;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241
3956
e60713655350 [gaim-migrate @ 4138]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3929
diff changeset
242 #ifdef _WIN32
e60713655350 [gaim-migrate @ 4138]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3929
diff changeset
243 /* Register window widget with wgaim systray module */
e60713655350 [gaim-migrate @ 4138]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3929
diff changeset
244 wgaim_created_backwin(imaway);
e60713655350 [gaim-migrate @ 4138]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3929
diff changeset
245 #endif
e60713655350 [gaim-migrate @ 4138]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3929
diff changeset
246
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
247 } else {
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
248 destroy_im_away();
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
249 do_away_message(w, a);
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
250 return;
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
251 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
252
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
253 /* New away message... Clear out the old sent_aways */
1775
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
254 while (away_time_queue) {
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
255 struct queued_away_response *qar = away_time_queue->data;
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
256 away_time_queue = g_slist_remove(away_time_queue, qar);
9ca22174da76 [gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
257 g_free(qar);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
258 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
259
1779
0da2a831c0ae [gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1775
diff changeset
260 gtk_widget_show(imaway);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
261 buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
262 strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
263 serv_set_away_all(buf2);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
264 g_free(buf2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
267 void rem_away_mess(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
268 {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
269 int default_index;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
270 default_index = g_slist_index(away_messages, default_away);
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
271 if (default_index == -1) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
272 if (away_messages != NULL)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
273 default_away = away_messages->data;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
274 else
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
275 default_away = NULL;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
276 }
1306
868f9c98db13 [gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1292
diff changeset
277 away_messages = g_slist_remove(away_messages, a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
278 g_free(a);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
279 do_away_menu();
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
280 save_prefs();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
281 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
282
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
283 static void set_gc_away(GtkObject *obj, struct gaim_connection *gc)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
284 {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
285 struct away_message *awy = gtk_object_get_user_data(obj);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
286
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
287 if (awy)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
288 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
289 else
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
290 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
291 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
292
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
293 static void set_gc_state(GtkObject *obj, struct gaim_connection *gc)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
294 {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
295 char *awy = gtk_object_get_user_data(obj);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
296
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
297 serv_set_away(gc, awy, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
298 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
299
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
300 void do_away_menu()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
302 GtkWidget *menuitem;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
303 GtkWidget *remmenu;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
304 GtkWidget *submenu, *submenu2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305 GtkWidget *remitem;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 GtkWidget *sep;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 GList *l;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
309 GtkWidget *list_item;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
310 GSList *awy = away_messages;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
311 struct away_message *a;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
312 GSList *con = connections;
1456
6650776468b3 [gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
313 struct gaim_connection *gc = NULL;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
314 int count = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
316 if (prefs_away_list != NULL) {
1790
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
317 GtkWidget *hbox;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
318 gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
319 while (awy) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320 a = (struct away_message *)awy->data;
1790
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
321 list_item = gtk_list_item_new();
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
322 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
323 g_signal_connect(GTK_OBJECT(list_item), "select",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
324 G_CALLBACK(away_list_clicked), a);
1790
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
325 gtk_object_set_user_data(GTK_OBJECT(list_item), a);
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
326 gtk_widget_show(list_item);
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
327
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
328 hbox = gtk_hbox_new(FALSE, 5);
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
329 gtk_container_add(GTK_CONTAINER(list_item), hbox);
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
330 gtk_widget_show(hbox);
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
331
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
332 label = gtk_label_new(a->name);
1790
c4864ac7792b [gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1779
diff changeset
333 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
334 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 939
diff changeset
336 awy = g_slist_next(awy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338 if (away_messages != NULL)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
339 gtk_list_select_item(GTK_LIST(prefs_away_list), 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
341
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
342 if (awaymenu) {
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
343 l = gtk_container_children(GTK_CONTAINER(awaymenu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
344
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
345 while (l) {
1530
0b6e4d52de63 [gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
346 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
347 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
348 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
351 remmenu = gtk_menu_new();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
353 menuitem = gtk_menu_item_new_with_label(_("New Away Message"));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
354 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
355 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
356 g_signal_connect(GTK_OBJECT(menuitem), "activate", G_CALLBACK(create_away_mess),
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
357 NULL);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
358
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
359 awy = away_messages;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
360 while (awy) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
361 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
362
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
363 remitem = gtk_menu_item_new_with_label(a->name);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
364 gtk_menu_append(GTK_MENU(remmenu), remitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
365 gtk_widget_show(remitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
366 g_signal_connect(GTK_OBJECT(remitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
367 G_CALLBACK(rem_away_mess), a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
368
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
369 awy = g_slist_next(awy);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
370
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
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 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
374 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375 gtk_widget_show(menuitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
376 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
377 gtk_widget_show(remmenu);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
378
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
379 sep = gtk_hseparator_new();
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
380 menuitem = gtk_menu_item_new();
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
381 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
382 gtk_container_add(GTK_CONTAINER(menuitem), sep);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
383 gtk_widget_set_sensitive(menuitem, FALSE);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
384 gtk_widget_show(menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
385 gtk_widget_show(sep);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
386
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
387 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
388 gc = con->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
389 if (gc->prpl->away_states &&gc->prpl->set_away)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
390 count++;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
391 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
392 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
393 con = connections;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
394
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
395 if (count == 0) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
396 } else if (count == 1) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
397 GList *msgs, *tmp;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
398 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
399 gc = con->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
400 if (gc->prpl->away_states &&gc->prpl->set_away)
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
401 break;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
402 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
403 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
404
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2640
diff changeset
405 tmp = msgs = gc->prpl->away_states(gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
406
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
407 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
408 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
409
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
410 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
411 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
412
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
413 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
414 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
415 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
416 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
417 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
418 G_CALLBACK(do_away_message), a);
1401
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 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
421 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
422 } else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
423 while (msgs) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
424 awy = away_messages;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
425
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
426 menuitem = gtk_menu_item_new_with_label(msgs->data);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
427 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
428 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
429 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
430
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
431 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
432 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
433 G_CALLBACK(set_gc_state), gc);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
434 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
435 submenu = gtk_menu_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
436 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
437 submenu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
438 gtk_widget_show(submenu);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
439
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
440 while (awy) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
441 a = (struct away_message *)awy->data;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
442
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
443 menuitem = gtk_menu_item_new_with_label(a->name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
444 gtk_object_set_user_data(GTK_OBJECT(menuitem),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
445 a);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
446 gtk_menu_append(GTK_MENU(submenu), menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
447 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
448 g_signal_connect(GTK_OBJECT(menuitem),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
449 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
450 G_CALLBACK
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
451 (do_away_message), a);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
452
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
453 awy = g_slist_next(awy);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
454 }
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
455 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
456 msgs = g_list_next(msgs);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
457 }
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
458
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
459 g_list_free(tmp);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
460 } else {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
461 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
462 char buf[256];
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
463 GList *msgs, *tmp;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
464 gc = con->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
465
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
466 if (!gc->prpl->away_states ||!gc->prpl->set_away) {
1545
34a5a436d04d [gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
467 con = con->next;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
468 continue;
1545
34a5a436d04d [gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
469 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
470
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
471 g_snprintf(buf, sizeof(buf), "%s (%s)",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3517
diff changeset
472 gc->username, gc->prpl->name);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
473 menuitem = gtk_menu_item_new_with_label(buf);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
474 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
475 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
476
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
477 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
478 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
479 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
480
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2640
diff changeset
481 tmp = msgs = gc->prpl->away_states(gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
482
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
483 if ((g_list_length(msgs) == 1) &&
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
484 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) {
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
485 menuitem = gtk_menu_item_new_with_label(_("Back"));
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
486 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
487 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
488 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
489 G_CALLBACK(set_gc_away), gc);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
490
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
491 sep = gtk_hseparator_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
492 menuitem = gtk_menu_item_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
493 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
494 gtk_container_add(GTK_CONTAINER(menuitem), sep);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
495 gtk_widget_set_sensitive(menuitem, FALSE);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
496 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
497 gtk_widget_show(sep);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
498
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
499 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
500
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
501 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
502 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
503
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
504 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
505 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
506 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
507 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
508 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
509 G_CALLBACK(set_gc_away), gc);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
510
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
511 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
512 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
513 } else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
514 while (msgs) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
515 awy = away_messages;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
516
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
517 menuitem = gtk_menu_item_new_with_label(msgs->data);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
518 gtk_object_set_user_data(GTK_OBJECT(menuitem),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
519 msgs->data);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
520 gtk_menu_append(GTK_MENU(submenu), menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
521 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
522
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
523 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
524 g_signal_connect(GTK_OBJECT(menuitem),
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
525 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
526 G_CALLBACK(set_gc_state),
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
527 gc);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
528 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
529 submenu2 = gtk_menu_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
530 gtk_menu_item_set_submenu(GTK_MENU_ITEM
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
531 (menuitem), submenu2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
532 gtk_widget_show(submenu2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
533
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
534 while (awy) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
535 a = (struct away_message *)awy->data;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
536
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
537 menuitem =
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
538 gtk_menu_item_new_with_label(a->
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
539 name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
540 gtk_object_set_user_data(GTK_OBJECT
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
541 (menuitem), a);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
542 gtk_menu_append(GTK_MENU(submenu2),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
543 menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
544 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
545 g_signal_connect(GTK_OBJECT(menuitem),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
546 "activate",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
547 G_CALLBACK
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
548 (set_gc_away), gc);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
549
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
550 awy = g_slist_next(awy);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
551 }
1401
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 msgs = g_list_next(msgs);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
554 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
555
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
556 g_list_free(tmp);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
557
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
558 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
559 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
560
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
561 menuitem = gtk_menu_item_new_with_label(_("Set All Away"));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
562 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
563 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
564
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
565 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
566 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
567 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
568
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
569 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
570
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
571 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
572 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
573
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
574 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
575 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
576 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
577 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
578 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4124
diff changeset
579 G_CALLBACK(do_away_message), a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
580
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
581 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
582 }
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
583 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
584 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
585 if (prefs_away_menu) {
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
586 l = gtk_container_children(GTK_CONTAINER(prefs_away_menu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
587 while (l) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
588 gtk_widget_destroy(GTK_WIDGET(l->data));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
589 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
590 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
591 gtk_widget_hide(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
592 default_away_menu_init(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
593 gtk_widget_show(prefs_away_menu);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
594 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
595
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
596 }