Mercurial > pidgin
annotate src/away.c @ 2988:9287c9465c50
[gaim-migrate @ 3001]
I am not a pronoun.
committer: Tailor Script <tailor@pidgin.im>
author | Adam Fritzler <mid@auk.cx> |
---|---|
date | Sun, 24 Feb 2002 00:54:23 +0000 |
parents | 8e924e4aa256 |
children | d33ec392a5e1 |
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 |
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 | 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); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
76 write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len); |
1773 | 77 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
78 message_queue = g_slist_remove(message_queue, qm); |
1773 | 79 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
80 g_free(qm->message); |
1774 | 81 g_free(qm); |
82 } | |
83 | |
1773 | 84 gtk_clist_thaw(GTK_CLIST(clistqueue)); |
85 } | |
86 | |
2573 | 87 void dequeue_by_buddy(GtkWidget *clist, gint row, gint column, GdkEventButton *event, gpointer data) { |
88 char *temp; | |
89 char *name; | |
90 GSList *templist; | |
91 struct conversation *cnv; | |
92 | |
93 if(!(event->type == GDK_2BUTTON_PRESS && event->button == 1)) | |
94 return; /* Double clicking on the clist will unqueue that users messages. */ | |
95 | |
96 gtk_clist_get_text(GTK_CLIST(clist), row, 0, &temp); | |
97 name = g_strdup(temp); | |
98 | |
99 if (!name) | |
100 return; | |
101 debug_printf("Unqueueing messages from %s.\n", name); | |
102 templist = message_queue; | |
103 while (templist) { | |
104 struct queued_message *qm = templist->data; | |
105 if (templist->data) { | |
106 if (!g_strcasecmp(qm->name, name)) { | |
107 cnv = find_conversation(name); | |
108 if (!cnv) | |
109 cnv = new_conversation(qm->name); | |
110 if (g_slist_index(connections, qm->gc) >= 0) | |
111 set_convo_gc(cnv, qm->gc); | |
112 | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
113 write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len); |
2573 | 114 g_free(qm->message); |
115 g_free(qm); | |
116 templist = message_queue = g_slist_remove(message_queue, qm); | |
117 | |
118 } else { | |
119 templist = templist->next; | |
120 } | |
121 } | |
122 } | |
123 g_free(name); | |
124 gtk_clist_remove(GTK_CLIST(clist), row); | |
125 | |
2604 | 126 #ifdef USE_APPLET |
127 set_user_state(away); | |
128 #endif | |
129 | |
2573 | 130 } |
131 | |
132 | |
133 | |
134 | |
1773 | 135 void toggle_away_queue() |
136 { | |
137 if (!clistqueue || !clistqueuesw) | |
138 return; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
139 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
140 if (away_options & OPT_AWAY_QUEUE) { |
1773 | 141 gtk_widget_show(clistqueue); |
142 gtk_widget_show(clistqueuesw); | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
143 } else { |
1773 | 144 gtk_widget_hide(clistqueue); |
145 gtk_widget_hide(clistqueuesw); | |
146 purge_away_queue(); | |
147 } | |
148 } | |
149 | |
1 | 150 void do_im_back(GtkWidget *w, GtkWidget *x) |
151 { | |
152 if (imaway) { | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
153 GtkWidget *tmp = imaway; |
1768 | 154 |
1773 | 155 purge_away_queue(); |
1768 | 156 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
157 imaway = NULL; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
158 gtk_widget_destroy(tmp); |
1614
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
159 if (w != tmp) |
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
160 return; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
161 } |
1 | 162 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
163 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
164 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
165 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
166 g_free(qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
167 } |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
168 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
169 serv_set_away_all(NULL); |
1 | 170 awaymessage = NULL; |
2640
cbc5c3861f77
[gaim-migrate @ 2653]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2604
diff
changeset
|
171 clistqueue = NULL; |
cbc5c3861f77
[gaim-migrate @ 2653]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2604
diff
changeset
|
172 clistqueuesw = NULL; |
1281
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
173 #ifdef USE_APPLET |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
174 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
175 set_user_state(online); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
176 insert_applet_away(); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
177 #endif /* USE_APPLET */ |
1 | 178 } |
179 | |
1044 | 180 |
1 | 181 void do_away_message(GtkWidget *w, struct away_message *a) |
182 { | |
183 GtkWidget *back; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
184 GtkWidget *awaytext; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
185 GtkWidget *sw; |
1 | 186 GtkWidget *vbox; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
187 char *buf2; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
188 char *buf; |
1 | 189 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
190 if (!blist) |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
191 return; |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
192 |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
193 if (!a) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
194 return; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
195 |
1 | 196 if (!imaway) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
197 GAIM_DIALOG(imaway); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
198 gtk_window_set_wmclass(GTK_WINDOW(imaway), "imaway", "Gaim"); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
199 if (strlen(a->name)) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
200 gtk_window_set_title(GTK_WINDOW(imaway), a->name); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
201 else |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
202 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!")); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
203 gtk_signal_connect(GTK_OBJECT(imaway), "destroy", GTK_SIGNAL_FUNC(do_im_back), imaway); |
1 | 204 gtk_widget_realize(imaway); |
205 aol_icon(imaway->window); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
206 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
207 vbox = gtk_vbox_new(FALSE, 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
208 gtk_container_add(GTK_CONTAINER(imaway), vbox); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
209 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
210 gtk_widget_show(vbox); |
1044 | 211 |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
212 sw = gtk_scrolled_window_new(NULL, NULL); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
213 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
|
214 GTK_POLICY_ALWAYS); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
215 gtk_widget_set_usize(sw, 245, 120); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
216 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
217 gtk_widget_show(sw); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
218 |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
219 awaytext = gtk_imhtml_new(NULL, NULL); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
220 gtk_container_add(GTK_CONTAINER(sw), awaytext); |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
221 GTK_LAYOUT(awaytext)->hadjustment->step_increment = 10.0; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
222 GTK_LAYOUT(awaytext)->vadjustment->step_increment = 10.0; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
223 gaim_setup_imhtml(awaytext); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
224 gtk_widget_show(awaytext); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
225 buf = stylize(a->message, BUF_LONG); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
226 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
|
227 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
228 g_free(buf); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
229 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
|
230 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
231 |
1773 | 232 clistqueuesw = gtk_scrolled_window_new(NULL, NULL); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
233 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clistqueuesw), GTK_POLICY_NEVER, |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
234 GTK_POLICY_AUTOMATIC); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
235 gtk_box_pack_start(GTK_BOX(vbox), clistqueuesw, TRUE, TRUE, 0); |
1773 | 236 |
237 clistqueue = gtk_clist_new(2); | |
238 gtk_clist_set_column_width(GTK_CLIST(clistqueue), 0, 100); | |
239 gtk_widget_set_usize(GTK_WIDGET(clistqueue), -1, 50); | |
240 gtk_container_add(GTK_CONTAINER(clistqueuesw), clistqueue); | |
2573 | 241 gtk_signal_connect(GTK_OBJECT(clistqueue), "select_row", GTK_SIGNAL_FUNC(dequeue_by_buddy), NULL); |
242 | |
243 | |
1773 | 244 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
245 if (away_options & OPT_AWAY_QUEUE) { |
1773 | 246 gtk_widget_show(clistqueuesw); |
247 gtk_widget_show(clistqueue); | |
248 } | |
249 | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
250 back = picture_button(imaway, _("I'm Back!"), join_xpm); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
251 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
252 gtk_signal_connect(GTK_OBJECT(back), "clicked", GTK_SIGNAL_FUNC(do_im_back), imaway); |
1 | 253 gtk_window_set_focus(GTK_WINDOW(imaway), back); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
254 |
1 | 255 awaymessage = a; |
256 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
257 } else { |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
258 destroy_im_away(); |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
259 do_away_message(w, a); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
260 return; |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
261 } |
1 | 262 |
1281
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
263 #ifdef USE_APPLET |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
264 remove_applet_away(); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
265 applet_widget_register_callback(APPLET_WIDGET(applet), |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
266 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
267 set_user_state(away); |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
268 #endif |
83d8b2078f4c
[gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
269 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
270 /* New away message... Clear out the old sent_aways */ |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
271 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
272 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
273 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
274 g_free(qar); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
275 } |
1 | 276 |
1779
0da2a831c0ae
[gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1775
diff
changeset
|
277 gtk_widget_show(imaway); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
278 buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
279 strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
280 serv_set_away_all(buf2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
281 g_free(buf2); |
1 | 282 } |
283 | |
284 void rem_away_mess(GtkWidget *w, struct away_message *a) | |
285 { | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
286 int default_index; |
18 | 287 #ifdef USE_APPLET |
288 char *awayname; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
289 awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name))); |
18 | 290 awayname[0] = '\0'; |
291 strcat(awayname, "away/"); | |
292 strcat(awayname, a->name); | |
293 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); | |
1129
282e6b7aef2c
[gaim-migrate @ 1139]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
294 g_free(awayname); |
18 | 295 #endif |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
296 default_index = g_slist_index(away_messages, default_away); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
297 if (default_index == -1) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
298 if (away_messages != NULL) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
299 default_away = away_messages->data; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
300 else |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
301 default_away = NULL; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
302 } |
1306
868f9c98db13
[gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1292
diff
changeset
|
303 away_messages = g_slist_remove(away_messages, a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
304 g_free(a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
305 do_away_menu(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
306 save_prefs(); |
1 | 307 } |
308 | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
309 static void set_gc_away(GtkObject *obj, struct gaim_connection *gc) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
310 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
311 struct away_message *awy = gtk_object_get_user_data(obj); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
312 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
313 if (awy) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
314 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
315 else |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
316 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
317 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
318 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
319 static void set_gc_state(GtkObject *obj, struct gaim_connection *gc) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
320 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
321 char *awy = gtk_object_get_user_data(obj); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
322 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
323 serv_set_away(gc, awy, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
324 } |
1 | 325 |
326 void do_away_menu() | |
327 { | |
328 GtkWidget *menuitem; | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
329 GtkWidget *remmenu; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
330 GtkWidget *submenu, *submenu2; |
1 | 331 GtkWidget *remitem; |
332 GtkWidget *label; | |
333 GtkWidget *sep; | |
334 GList *l; | |
335 GtkWidget *list_item; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
336 GSList *awy = away_messages; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
337 struct away_message *a; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
338 GSList *con = connections; |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
339 struct gaim_connection *gc = NULL; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
340 int count = 0; |
1 | 341 |
18 | 342 #ifdef USE_APPLET |
343 remove_applet_away(); | |
1591
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1575
diff
changeset
|
344 if (imaway && applet) |
18 | 345 applet_widget_register_callback(APPLET_WIDGET(applet), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
346 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); |
1607
4ad4dac68317
[gaim-migrate @ 1617]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1591
diff
changeset
|
347 else if (applet && !imaway) |
1591
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1575
diff
changeset
|
348 insert_applet_away(); |
18 | 349 #endif |
1 | 350 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
351 if (prefs_away_list != NULL) { |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
352 GtkWidget *hbox; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
353 gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
354 while (awy) { |
1 | 355 a = (struct away_message *)awy->data; |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
356 list_item = gtk_list_item_new(); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
357 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
358 gtk_signal_connect(GTK_OBJECT(list_item), "select", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
359 GTK_SIGNAL_FUNC(away_list_clicked), a); |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
360 gtk_object_set_user_data(GTK_OBJECT(list_item), a); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
361 gtk_widget_show(list_item); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
362 |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
363 hbox = gtk_hbox_new(FALSE, 5); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
364 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
365 gtk_widget_show(hbox); |
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
366 |
1 | 367 label = gtk_label_new(a->name); |
1790
c4864ac7792b
[gaim-migrate @ 1800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1779
diff
changeset
|
368 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1 | 369 gtk_widget_show(label); |
370 | |
940 | 371 awy = g_slist_next(awy); |
1 | 372 } |
373 if (away_messages != NULL) | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
374 gtk_list_select_item(GTK_LIST(prefs_away_list), 0); |
1 | 375 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
376 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
377 if (awaymenu) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
378 l = gtk_container_children(GTK_CONTAINER(awaymenu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
379 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
380 while (l) { |
1530
0b6e4d52de63
[gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
381 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data)); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
382 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
383 } |
1 | 384 |
385 | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
386 remmenu = gtk_menu_new(); |
1 | 387 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
388 menuitem = gtk_menu_item_new_with_label(_("New Away Message")); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
389 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
390 gtk_widget_show(menuitem); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
391 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
|
392 NULL); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
393 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
394 awy = away_messages; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
395 while (awy) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
396 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
397 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
398 remitem = gtk_menu_item_new_with_label(a->name); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
399 gtk_menu_append(GTK_MENU(remmenu), remitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
400 gtk_widget_show(remitem); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
401 gtk_signal_connect(GTK_OBJECT(remitem), "activate", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
402 GTK_SIGNAL_FUNC(rem_away_mess), a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
403 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
404 awy = g_slist_next(awy); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
405 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
406 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
407 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
408 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); |
1 | 409 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
410 gtk_widget_show(menuitem); | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
411 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
412 gtk_widget_show(remmenu); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
413 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
414 sep = gtk_hseparator_new(); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
415 menuitem = gtk_menu_item_new(); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
416 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
417 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
418 gtk_widget_set_sensitive(menuitem, FALSE); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
419 gtk_widget_show(menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
420 gtk_widget_show(sep); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
421 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
422 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
423 gc = con->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
424 if (gc->prpl->away_states &&gc->prpl->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
425 count++; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
426 con = g_slist_next(con); |
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 con = connections; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
429 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
430 if (count == 0) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
431 } else if (count == 1) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
432 GList *msgs, *tmp; |
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 gc = con->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
435 if (gc->prpl->away_states &&gc->prpl->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
436 break; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
437 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
438 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
439 |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2640
diff
changeset
|
440 tmp = msgs = gc->prpl->away_states(gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
441 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
442 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
|
443 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
444 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
445 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
446 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
447 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
448 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
449 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
450 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
451 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
452 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
453 GTK_SIGNAL_FUNC(do_away_message), a); |
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 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
456 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
457 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
458 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
459 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
460 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
461 menuitem = gtk_menu_item_new_with_label(msgs->data); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
462 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
463 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
464 gtk_widget_show(menuitem); |
1401
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 (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
467 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
468 GTK_SIGNAL_FUNC(set_gc_state), gc); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
469 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
470 submenu = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
471 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
472 submenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
473 gtk_widget_show(submenu); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
474 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
475 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
476 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
477 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
478 menuitem = gtk_menu_item_new_with_label(a->name); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
479 gtk_object_set_user_data(GTK_OBJECT(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
480 a); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
481 gtk_menu_append(GTK_MENU(submenu), menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
482 gtk_widget_show(menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
483 gtk_signal_connect(GTK_OBJECT(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
484 "activate", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
485 GTK_SIGNAL_FUNC |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
486 (do_away_message), a); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
487 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
488 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
489 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
490 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
491 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
492 } |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
493 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
494 g_list_free(tmp); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
495 } else { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
496 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
497 char buf[256]; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
498 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
499 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
500 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
501 if (!gc->prpl->away_states ||!gc->prpl->set_away) { |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
502 con = con->next; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
503 continue; |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
504 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
505 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
506 g_snprintf(buf, sizeof(buf), "%s (%s)", |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2640
diff
changeset
|
507 gc->username, gc->prpl->name()); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
508 menuitem = gtk_menu_item_new_with_label(buf); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
509 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
510 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
511 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
512 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
513 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
514 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
515 |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2640
diff
changeset
|
516 tmp = msgs = gc->prpl->away_states(gc); |
1401
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 if ((g_list_length(msgs) == 1) && |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
519 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
520 menuitem = gtk_menu_item_new_with_label(_("Back")); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
521 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
522 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
523 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
524 GTK_SIGNAL_FUNC(set_gc_away), gc); |
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 sep = gtk_hseparator_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
527 menuitem = gtk_menu_item_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
528 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
529 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
530 gtk_widget_set_sensitive(menuitem, FALSE); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
531 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
532 gtk_widget_show(sep); |
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; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
538 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
539 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(set_gc_away), gc); |
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 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
548 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
549 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
550 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
551 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
552 menuitem = gtk_menu_item_new_with_label(msgs->data); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
553 gtk_object_set_user_data(GTK_OBJECT(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
554 msgs->data); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
555 gtk_menu_append(GTK_MENU(submenu), menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
556 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
557 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
558 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
559 gtk_signal_connect(GTK_OBJECT(menuitem), |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
560 "activate", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
561 GTK_SIGNAL_FUNC(set_gc_state), |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
562 gc); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
563 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
564 submenu2 = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
565 gtk_menu_item_set_submenu(GTK_MENU_ITEM |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
566 (menuitem), submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
567 gtk_widget_show(submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
568 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
569 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
570 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
571 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
572 menuitem = |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
573 gtk_menu_item_new_with_label(a-> |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
574 name); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
575 gtk_object_set_user_data(GTK_OBJECT |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
576 (menuitem), a); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
577 gtk_menu_append(GTK_MENU(submenu2), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
578 menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
579 gtk_widget_show(menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
580 gtk_signal_connect(GTK_OBJECT(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
581 "activate", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
582 GTK_SIGNAL_FUNC |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
583 (set_gc_away), gc); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
584 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
585 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
586 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
587 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
588 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
589 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
590 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
591 g_list_free(tmp); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
592 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
593 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
594 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
595 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
596 menuitem = gtk_menu_item_new_with_label(_("Set All Away")); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
597 gtk_menu_append(GTK_MENU(awaymenu), menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
598 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
599 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
600 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
601 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
602 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
603 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
604 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
605 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
606 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
607 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
608 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
609 menuitem = gtk_menu_item_new_with_label(a->name); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
610 gtk_object_set_user_data(GTK_OBJECT(menuitem), a); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
611 gtk_menu_append(GTK_MENU(submenu), menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
612 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
613 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
614 GTK_SIGNAL_FUNC(do_away_message), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
615 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
616 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
617 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
618 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
619 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
620 if (prefs_away_menu) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
621 l = gtk_container_children(GTK_CONTAINER(prefs_away_menu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
622 while (l) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
623 gtk_widget_destroy(GTK_WIDGET(l->data)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
624 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
625 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
626 gtk_widget_hide(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
627 default_away_menu_init(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
628 gtk_widget_show(prefs_away_menu); |
1 | 629 } |
630 | |
631 } |