Mercurial > pidgin
annotate src/away.c @ 1900:43006f782adb
[gaim-migrate @ 1910]
no newline
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 28 May 2001 05:20:52 +0000 |
parents | 73d73939f698 |
children | e43c267b1a8a |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
26 #include <gnome.h> | |
27 #include <applet-widget.h> | |
1261
07f0bb41bbe1
[gaim-migrate @ 1271]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1254
diff
changeset
|
28 #include "applet.h" |
1 | 29 #endif /* USE_APPLET */ |
30 #include <string.h> | |
31 #include <stdio.h> | |
32 #include <stdlib.h> | |
33 #include <time.h> | |
34 | |
35 #include <gtk/gtk.h> | |
36 #include "gaim.h" | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
37 #include "prpl.h" |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
38 #include "gtkimhtml.h" |
621 | 39 #include "pixmaps/join.xpm" |
1 | 40 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
41 GtkWidget *imaway = NULL; |
1 | 42 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
43 GtkWidget *awaymenu = NULL; |
1773 | 44 GtkWidget *clistqueue = NULL; |
45 GtkWidget *clistqueuesw; | |
46 | |
1 | 47 struct away_message *awaymessage = NULL; |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
48 struct away_message *default_away; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
49 int auto_away; |
1 | 50 |
51 static void destroy_im_away() | |
52 { | |
53 if (imaway) | |
54 gtk_widget_destroy(imaway); | |
1774 | 55 |
56 clistqueue = NULL; | |
57 clistqueuesw = NULL; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
58 imaway = NULL; |
1 | 59 } |
60 | |
1773 | 61 void purge_away_queue() |
62 { | |
63 struct conversation *cnv; | |
64 | |
65 gtk_clist_freeze(GTK_CLIST(clistqueue)); | |
66 gtk_clist_clear(GTK_CLIST(clistqueue)); | |
67 | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
68 while (message_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
69 struct queued_message *qm = message_queue->data; |
1773 | 70 |
71 cnv = find_conversation(qm->name); | |
72 if (!cnv) | |
73 cnv = new_conversation(qm->name); | |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1888
diff
changeset
|
74 if (g_slist_index(connections, qm->gc) >= 0) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1888
diff
changeset
|
75 set_convo_gc(cnv, qm->gc); |
1773 | 76 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
77 write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm); |
1773 | 78 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
79 message_queue = g_slist_remove(message_queue, qm); |
1773 | 80 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
81 g_free(qm->message); |
1774 | 82 g_free(qm); |
83 } | |
84 | |
1773 | 85 gtk_clist_thaw(GTK_CLIST(clistqueue)); |
86 } | |
87 | |
88 void toggle_away_queue() | |
89 { | |
90 if (!clistqueue || !clistqueuesw) | |
91 return; | |
92 | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
93 if (general_options & OPT_GEN_QUEUE_WHEN_AWAY) { |
1773 | 94 gtk_widget_show(clistqueue); |
95 gtk_widget_show(clistqueuesw); | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
96 } else { |
1773 | 97 gtk_widget_hide(clistqueue); |
98 gtk_widget_hide(clistqueuesw); | |
99 purge_away_queue(); | |
100 } | |
101 } | |
102 | |
1 | 103 void do_im_back(GtkWidget *w, GtkWidget *x) |
104 { | |
105 if (imaway) { | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
106 GtkWidget *tmp = imaway; |
1768 | 107 |
1773 | 108 purge_away_queue(); |
1768 | 109 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
110 imaway = NULL; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
111 gtk_widget_destroy(tmp); |
1614
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
112 if (w != tmp) |
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
113 return; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
114 } |
1 | 115 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
116 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
117 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
118 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
119 g_free(qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
120 } |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
121 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
122 serv_set_away_all(NULL); |
1 | 123 awaymessage = NULL; |
1281
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
124 #ifdef USE_APPLET |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
125 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
126 set_user_state(online); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
127 insert_applet_away(); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
128 #endif /* USE_APPLET */ |
1 | 129 } |
130 | |
1044 | 131 |
1 | 132 void do_away_message(GtkWidget *w, struct away_message *a) |
133 { | |
134 GtkWidget *back; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
135 GtkWidget *awaytext; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
136 GtkWidget *sw; |
1 | 137 GtkWidget *vbox; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
138 char *buf2; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
139 char *buf; |
1 | 140 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
141 if (!blist) |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
142 return; |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
143 |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
144 if (!a) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
145 return; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
146 |
1 | 147 if (!imaway) { |
148 imaway = gtk_window_new(GTK_WINDOW_DIALOG); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
149 gtk_window_set_wmclass(GTK_WINDOW(imaway), "imaway", "Gaim"); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
150 if (strlen(a->name)) |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
151 gtk_window_set_title(GTK_WINDOW(imaway), a->name); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
152 else |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
153 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!")); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
154 gtk_signal_connect(GTK_OBJECT(imaway), "destroy", GTK_SIGNAL_FUNC(do_im_back), imaway); |
1 | 155 gtk_widget_realize(imaway); |
156 aol_icon(imaway->window); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
157 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
158 vbox = gtk_vbox_new(FALSE, 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
159 gtk_container_add(GTK_CONTAINER(imaway), vbox); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
160 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
161 gtk_widget_show(vbox); |
1044 | 162 |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
163 sw = gtk_scrolled_window_new(NULL, NULL); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
164 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
165 gtk_widget_set_usize(sw, 245, 120); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
166 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
167 gtk_widget_show(sw); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
168 |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
169 awaytext = gtk_imhtml_new(NULL, NULL); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
170 gtk_container_add(GTK_CONTAINER(sw), awaytext); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
171 gaim_setup_imhtml(awaytext); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
172 gtk_widget_show(awaytext); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
173 buf = stylize(a->message, BUF_LONG); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
174 gtk_imhtml_append_text(GTK_IMHTML(awaytext), buf, GTK_IMHTML_NO_TITLE | |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
175 GTK_IMHTML_NO_COMMENTS | |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
176 GTK_IMHTML_NO_SCROLL); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
177 g_free(buf); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
178 |
1773 | 179 clistqueuesw = gtk_scrolled_window_new(NULL, NULL); |
180 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clistqueuesw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
181 gtk_box_pack_start(GTK_BOX(vbox), clistqueuesw, TRUE, TRUE, 0); |
1773 | 182 |
183 clistqueue = gtk_clist_new(2); | |
184 gtk_clist_set_column_width(GTK_CLIST(clistqueue), 0, 100); | |
185 gtk_widget_set_usize(GTK_WIDGET(clistqueue), -1, 50); | |
186 gtk_container_add(GTK_CONTAINER(clistqueuesw), clistqueue); | |
187 | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
188 if (general_options & OPT_GEN_QUEUE_WHEN_AWAY) { |
1773 | 189 gtk_widget_show(clistqueuesw); |
190 gtk_widget_show(clistqueue); | |
191 } | |
192 | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
193 back = picture_button(imaway, _("I'm Back!"), join_xpm); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
194 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
195 gtk_signal_connect(GTK_OBJECT(back), "clicked", GTK_SIGNAL_FUNC(do_im_back), imaway); |
1 | 196 gtk_window_set_focus(GTK_WINDOW(imaway), back); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
197 |
1 | 198 awaymessage = a; |
199 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
200 } else { |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
201 destroy_im_away(); |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
202 do_away_message(w, a); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
203 return; |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
204 } |
1 | 205 |
1281
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
206 #ifdef USE_APPLET |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
207 remove_applet_away(); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
208 applet_widget_register_callback(APPLET_WIDGET(applet), |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
209 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
210 set_user_state(away); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
211 #endif |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
212 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
213 /* New away message... Clear out the old sent_aways */ |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
214 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
215 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
216 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
217 g_free(qar); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
218 } |
1 | 219 |
1779
0da2a831c0ae
[gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1775
diff
changeset
|
220 gtk_widget_show(imaway); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
221 buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
222 strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
223 serv_set_away_all(buf2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
224 g_free(buf2); |
1 | 225 } |
226 | |
227 void rem_away_mess(GtkWidget *w, struct away_message *a) | |
228 { | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
229 int default_index; |
18 | 230 #ifdef USE_APPLET |
231 char *awayname; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
232 awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name))); |
18 | 233 awayname[0] = '\0'; |
234 strcat(awayname, "away/"); | |
235 strcat(awayname, a->name); | |
236 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); | |
1129
282e6b7aef2c
[gaim-migrate @ 1139]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
237 g_free(awayname); |
18 | 238 #endif |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
239 default_index = g_slist_index(away_messages, default_away); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
240 if (default_index == -1) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
241 if (away_messages != NULL) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
242 default_away = away_messages->data; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
243 else |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
244 default_away = NULL; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
245 } |
1306
868f9c98db13
[gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1292
diff
changeset
|
246 away_messages = g_slist_remove(away_messages, a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
247 g_free(a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
248 do_away_menu(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
249 save_prefs(); |
1 | 250 } |
251 | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
252 static void set_gc_away(GtkObject *obj, struct gaim_connection *gc) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
253 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
254 struct away_message *awy = gtk_object_get_user_data(obj); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
255 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
256 if (awy) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
257 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
258 else |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
259 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
260 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
261 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
262 static void set_gc_state(GtkObject *obj, struct gaim_connection *gc) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
263 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
264 char *awy = gtk_object_get_user_data(obj); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
265 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
266 serv_set_away(gc, awy, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
267 } |
1 | 268 |
269 void do_away_menu() | |
270 { | |
271 GtkWidget *menuitem; | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
272 GtkWidget *remmenu; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
273 GtkWidget *submenu, *submenu2; |
1 | 274 GtkWidget *remitem; |
275 GtkWidget *label; | |
276 GtkWidget *sep; | |
277 GList *l; | |
278 GtkWidget *list_item; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
279 GSList *awy = away_messages; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
280 struct away_message *a; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
281 GSList *con = connections; |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
282 struct gaim_connection *gc = NULL; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
283 int count = 0; |
1 | 284 |
18 | 285 #ifdef USE_APPLET |
286 remove_applet_away(); | |
1591
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1575
diff
changeset
|
287 if (imaway && applet) |
18 | 288 applet_widget_register_callback(APPLET_WIDGET(applet), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
289 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); |
1607
4ad4dac68317
[gaim-migrate @ 1617]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1591
diff
changeset
|
290 else if (applet && !imaway) |
1591
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1575
diff
changeset
|
291 insert_applet_away(); |
18 | 292 #endif |
1 | 293 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
294 if (prefs_away_list != NULL) { |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
295 GtkWidget *hbox; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
296 gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
297 while (awy) { |
1 | 298 a = (struct away_message *)awy->data; |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
299 list_item = gtk_list_item_new(); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
300 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
301 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), a); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
302 gtk_object_set_user_data(GTK_OBJECT(list_item), a); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
303 gtk_widget_show(list_item); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
304 |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
305 hbox = gtk_hbox_new(FALSE, 5); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
306 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
307 gtk_widget_show(hbox); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
308 |
1 | 309 label = gtk_label_new(a->name); |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
310 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1 | 311 gtk_widget_show(label); |
312 | |
940 | 313 awy = g_slist_next(awy); |
1 | 314 } |
315 if (away_messages != NULL) | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
316 gtk_list_select_item(GTK_LIST(prefs_away_list), 0); |
1 | 317 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
318 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
319 if (awaymenu) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
320 l = gtk_container_children(GTK_CONTAINER(awaymenu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
321 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
322 while (l) { |
1530
0b6e4d52de63
[gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
323 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data)); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
324 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
325 } |
1 | 326 |
327 | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
328 remmenu = gtk_menu_new(); |
1 | 329 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
330 menuitem = gtk_menu_item_new_with_label(_("New Away Message")); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
331 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
332 gtk_widget_show(menuitem); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
333 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(create_away_mess), |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
334 NULL); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
335 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
336 awy = away_messages; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
337 while (awy) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
338 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
339 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
340 remitem = gtk_menu_item_new_with_label(a->name); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
341 gtk_menu_append(GTK_MENU(remmenu), remitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
342 gtk_widget_show(remitem); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
343 gtk_signal_connect(GTK_OBJECT(remitem), "activate", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
344 GTK_SIGNAL_FUNC(rem_away_mess), a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
345 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
346 awy = g_slist_next(awy); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
347 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
348 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
349 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
350 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); |
1 | 351 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
352 gtk_widget_show(menuitem); | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
353 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
354 gtk_widget_show(remmenu); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
355 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
356 sep = gtk_hseparator_new(); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
357 menuitem = gtk_menu_item_new(); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
358 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
359 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
360 gtk_widget_set_sensitive(menuitem, FALSE); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
361 gtk_widget_show(menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
362 gtk_widget_show(sep); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
363 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
364 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
365 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
366 if (gc->prpl->away_states && gc->prpl->set_away) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
367 count++; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
368 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
369 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
370 con = connections; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
371 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
372 if (count == 0) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
373 } else if (count == 1) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
374 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
375 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
376 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
377 if (gc->prpl->away_states && gc->prpl->set_away) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
378 break; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
379 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
380 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
381 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
382 tmp = msgs = (*gc->prpl->away_states)(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
383 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
384 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
|
385 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
386 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
387 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
388 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
389 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
390 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
391 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
392 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
393 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
394 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
395 GTK_SIGNAL_FUNC(do_away_message), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
396 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
397 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
398 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
399 } else while (msgs) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
400 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
401 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
402 menuitem = gtk_menu_item_new_with_label(msgs->data); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
403 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
404 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
405 gtk_widget_show(menuitem); |
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 (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
408 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
409 GTK_SIGNAL_FUNC(set_gc_state), gc); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
410 } else { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
411 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
412 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
413 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
414 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
415 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
416 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
417 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
418 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
419 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
420 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
421 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
422 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
1726
004725b3a851
[gaim-migrate @ 1736]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1614
diff
changeset
|
423 GTK_SIGNAL_FUNC(do_away_message), a); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
424 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
425 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
426 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
427 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
428 msgs = g_list_next(msgs); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
429 } |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
430 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
431 g_list_free(tmp); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
432 } else { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
433 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
434 char buf[256]; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
435 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
436 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
437 |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
438 if (!gc->prpl->away_states || !gc->prpl->set_away) { |
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
439 con = con->next; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
440 continue; |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
441 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
442 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
443 g_snprintf(buf, sizeof(buf), "%s (%s)", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
444 gc->username, (*gc->prpl->name)()); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
445 menuitem = gtk_menu_item_new_with_label(buf); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
446 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
447 gtk_widget_show(menuitem); |
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 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
450 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
451 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
452 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
453 tmp = msgs = (*gc->prpl->away_states)(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
454 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
455 if ((g_list_length(msgs) == 1) && |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
456 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
457 menuitem = gtk_menu_item_new_with_label(_("Back")); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
458 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
459 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
460 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
461 GTK_SIGNAL_FUNC(set_gc_away), gc); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
462 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
463 sep = gtk_hseparator_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
464 menuitem = gtk_menu_item_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
465 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
466 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
467 gtk_widget_set_sensitive(menuitem, FALSE); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
468 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
469 gtk_widget_show(sep); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
470 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
471 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
472 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
473 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
474 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
475 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
476 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
477 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
478 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
479 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
480 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
481 GTK_SIGNAL_FUNC(set_gc_away), gc); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
482 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
483 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
484 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
485 } else while (msgs) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
486 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
487 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
488 menuitem = gtk_menu_item_new_with_label(msgs->data); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
489 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
490 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
491 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
492 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
493 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
494 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
495 GTK_SIGNAL_FUNC(set_gc_state), gc); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
496 } else { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
497 submenu2 = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
498 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
499 submenu2); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
500 gtk_widget_show(submenu2); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
501 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
502 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
503 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
504 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
505 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
506 gtk_object_set_user_data(GTK_OBJECT(menuitem), |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
507 a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
508 gtk_menu_append(GTK_MENU(submenu2), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
509 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
510 gtk_signal_connect(GTK_OBJECT(menuitem), |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
511 "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
512 GTK_SIGNAL_FUNC(set_gc_away), |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
513 gc); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
514 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
515 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
516 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
517 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
518 msgs = g_list_next(msgs); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
519 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
520 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
521 g_list_free(tmp); |
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 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
524 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
525 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
526 menuitem = gtk_menu_item_new_with_label(_("Set All Away")); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
527 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
528 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
529 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
530 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
531 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
532 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
533 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
534 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
535 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
536 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
537 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
538 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
539 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
540 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
541 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
542 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
543 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
544 GTK_SIGNAL_FUNC(do_away_message), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
545 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
546 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
547 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
548 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
549 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
550 if (prefs_away_menu) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
551 l = gtk_container_children(GTK_CONTAINER(prefs_away_menu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
552 while (l) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
553 gtk_widget_destroy(GTK_WIDGET(l->data)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
554 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
555 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
556 gtk_widget_hide(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
557 default_away_menu_init(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
558 gtk_widget_show(prefs_away_menu); |
1 | 559 } |
560 | |
561 } |