Mercurial > pidgin.yaz
annotate src/away.c @ 5080:0e639df44fb5
[gaim-migrate @ 5434]
security is good, mmmkay?
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 08 Apr 2003 03:52:29 +0000 |
parents | 8e55a4d362a3 |
children | 91ea5ef2278b |
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 #include <string.h> |
26 #include <stdio.h> | |
27 #include <stdlib.h> | |
28 #include <time.h> | |
29 | |
30 #include <gtk/gtk.h> | |
31 #include "gaim.h" | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
32 #include "prpl.h" |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
33 #include "gtkimhtml.h" |
4687 | 34 #include "gtklist.h" |
1 | 35 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
36 GtkWidget *imaway = NULL; |
1 | 37 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
38 GtkWidget *awaymenu = NULL; |
4412 | 39 GtkWidget *awayqueue = NULL; |
40 GtkListStore *awayqueuestore = NULL; | |
41 GtkWidget *awayqueuesw; | |
1773 | 42 |
1 | 43 struct away_message *awaymessage = NULL; |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
44 struct away_message *default_away; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
45 int auto_away; |
1 | 46 |
47 static void destroy_im_away() | |
48 { | |
49 if (imaway) | |
50 gtk_widget_destroy(imaway); | |
1774 | 51 |
4412 | 52 awayqueue = NULL; |
53 g_object_unref(G_OBJECT(awayqueuestore)); | |
54 awayqueuestore = NULL; | |
55 awayqueuesw = NULL; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
56 imaway = NULL; |
1 | 57 } |
58 | |
4412 | 59 static void dequeue_message(GtkTreeIter *iter) |
60 { | |
61 gchar *name; | |
62 GSList *templist; | |
63 struct gaim_conversation *cnv; | |
64 | |
65 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1); | |
4491 | 66 |
4412 | 67 debug_printf("Unqueueing messages from %s.\n", name); |
4491 | 68 |
4412 | 69 templist = message_queue; |
4491 | 70 |
4412 | 71 while (templist) { |
72 struct queued_message *qm = templist->data; | |
73 if (templist->data) { | |
4793 | 74 if (!gaim_utf8_strcasecmp(qm->name, name)) { |
4491 | 75 struct gaim_account *account = NULL; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
76 |
4608 | 77 if (g_slist_index(gaim_accounts, qm->account) >= 0) |
78 account = qm->account; | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
79 |
4412 | 80 cnv = gaim_find_conversation(name); |
81 | |
82 if (!cnv) | |
4491 | 83 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
84 else |
4491 | 85 gaim_conversation_set_account(cnv, account); |
4412 | 86 |
87 gaim_im_write(GAIM_IM(cnv), NULL, qm->message, qm->len, | |
88 qm->flags, qm->tm); | |
89 g_free(qm->message); | |
90 g_free(qm); | |
91 templist = message_queue = g_slist_remove(message_queue, qm); | |
4491 | 92 |
4412 | 93 } else { |
94 templist = templist->next; | |
95 } | |
96 } | |
97 } | |
98 | |
99 g_free(name); | |
100 /* In GTK 2.2, _store_remove actually returns whether iter is valid or not | |
101 * after the remove, but in GTK 2.0 it is a void function. */ | |
102 gtk_list_store_remove(awayqueuestore, iter); | |
103 } | |
104 | |
4274 | 105 void purge_away_queue(GSList **queue) |
1773 | 106 { |
4274 | 107 GSList *q = *queue; |
108 struct queued_message *qm; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
109 struct gaim_conversation *cnv; |
4491 | 110 struct gaim_account *account; |
1773 | 111 |
4274 | 112 while (q) { |
113 qm = q->data; | |
4167 | 114 |
4491 | 115 account = NULL; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
116 |
4608 | 117 if (g_slist_index(gaim_accounts, qm->account) >= 0) |
118 account = qm->account; | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
119 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
120 cnv = gaim_find_conversation(qm->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
121 |
4167 | 122 if (!cnv) |
4491 | 123 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
124 else |
4491 | 125 gaim_conversation_set_account(cnv, account); |
4274 | 126 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
127 gaim_im_write(GAIM_IM(cnv), NULL, qm->message, -1, qm->flags, qm->tm); |
4167 | 128 |
129 g_free(qm->message); | |
130 g_free(qm); | |
4274 | 131 |
132 q->data = NULL; | |
133 q = q->next; | |
4167 | 134 } |
135 | |
4274 | 136 g_slist_free(*queue); |
137 *queue = NULL; | |
4167 | 138 } |
139 | |
4412 | 140 gint dequeue_cb(GtkWidget *treeview, GdkEventButton *event, gpointer data) { |
141 GtkTreeIter iter; | |
142 GtkTreeSelection *select; | |
4491 | 143 |
4167 | 144 if(!(event->type == GDK_2BUTTON_PRESS && event->button == 1)) |
4412 | 145 return FALSE; /* Double clicking on the list will unqueue that user's messages. */ |
4491 | 146 |
4412 | 147 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
148 if(gtk_tree_selection_get_selected(select, NULL, &iter)) | |
149 dequeue_message(&iter); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
150 |
4412 | 151 return FALSE; |
4167 | 152 } |
4491 | 153 |
2573 | 154 |
155 | |
1773 | 156 void toggle_away_queue() |
157 { | |
4412 | 158 if (!awayqueue || !awayqueuesw) |
1773 | 159 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
160 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
161 if (away_options & OPT_AWAY_QUEUE) { |
4412 | 162 gtk_widget_show(awayqueue); |
163 gtk_widget_show(awayqueuesw); | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
164 } else { |
4412 | 165 gtk_widget_hide(awayqueue); |
166 gtk_widget_hide(awayqueuesw); | |
4274 | 167 purge_away_queue(&message_queue); |
1773 | 168 } |
169 } | |
170 | |
1 | 171 void do_im_back(GtkWidget *w, GtkWidget *x) |
172 { | |
173 if (imaway) { | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
174 GtkWidget *tmp = imaway; |
1768 | 175 |
4274 | 176 purge_away_queue(&message_queue); |
177 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
178 imaway = NULL; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
179 gtk_widget_destroy(tmp); |
1614
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
180 if (w != tmp) |
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
181 return; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
182 } |
1 | 183 |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
184 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
185 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
186 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
187 g_free(qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
188 } |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
189 |
1 | 190 awaymessage = NULL; |
4412 | 191 awayqueue = NULL; |
192 awayqueuesw = NULL; | |
193 g_object_unref(G_OBJECT(awayqueuestore)); | |
194 awayqueuestore = NULL; | |
3514 | 195 serv_set_away_all(NULL); |
1 | 196 } |
197 | |
1044 | 198 |
1 | 199 void do_away_message(GtkWidget *w, struct away_message *a) |
200 { | |
201 GtkWidget *back; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
202 GtkWidget *awaytext; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
203 GtkWidget *sw; |
1 | 204 GtkWidget *vbox; |
4412 | 205 GtkTreeViewColumn *column; |
206 GtkCellRenderer *renderer; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
207 char *buf2; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
208 char *buf; |
1 | 209 |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
210 if (!a) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
211 return; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
212 |
1 | 213 if (!imaway) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
214 GAIM_DIALOG(imaway); |
4074 | 215 gtk_window_set_role(GTK_WINDOW(imaway), "imaway"); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
216 if (strlen(a->name)) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
217 gtk_window_set_title(GTK_WINDOW(imaway), a->name); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
218 else |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
219 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
220 g_signal_connect(G_OBJECT(imaway), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
221 G_CALLBACK(do_im_back), imaway); |
1 | 222 gtk_widget_realize(imaway); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
223 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
224 vbox = gtk_vbox_new(FALSE, 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
225 gtk_container_add(GTK_CONTAINER(imaway), vbox); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
226 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
227 gtk_widget_show(vbox); |
1044 | 228 |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
229 sw = gtk_scrolled_window_new(NULL, NULL); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
230 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
|
231 GTK_POLICY_ALWAYS); |
3929 | 232 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4635 | 233 gtk_widget_set_size_request(sw, 245, 120); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
234 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
235 gtk_widget_show(sw); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
236 |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
237 awaytext = gtk_imhtml_new(NULL, NULL); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
238 gtk_container_add(GTK_CONTAINER(sw), awaytext); |
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
239 gaim_setup_imhtml(awaytext); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
240 gtk_widget_show(awaytext); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
241 buf = stylize(a->message, BUF_LONG); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
242 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
|
243 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
244 g_free(buf); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
245 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
|
246 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
247 |
4412 | 248 awayqueuesw = gtk_scrolled_window_new(NULL, NULL); |
249 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(awayqueuesw), GTK_POLICY_NEVER, | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
250 GTK_POLICY_AUTOMATIC); |
4412 | 251 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(awayqueuesw), |
252 GTK_SHADOW_IN); | |
253 gtk_box_pack_start(GTK_BOX(vbox), awayqueuesw, TRUE, TRUE, 0); | |
1773 | 254 |
4412 | 255 awayqueuestore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); |
256 awayqueue = gtk_tree_view_new_with_model(GTK_TREE_MODEL(awayqueuestore)); | |
257 renderer = gtk_cell_renderer_text_new(); | |
258 | |
259 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(awayqueue), FALSE); | |
260 column = gtk_tree_view_column_new_with_attributes (NULL, renderer, | |
261 "text", 0, | |
262 NULL); | |
263 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column); | |
264 column = gtk_tree_view_column_new_with_attributes(NULL, renderer, | |
265 "text", 1, | |
266 NULL); | |
267 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column); | |
268 | |
269 gtk_container_add(GTK_CONTAINER(awayqueuesw), awayqueue); | |
270 | |
271 g_signal_connect(G_OBJECT(awayqueue), "button_press_event", G_CALLBACK(dequeue_cb), NULL); | |
2573 | 272 |
1773 | 273 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
274 if (away_options & OPT_AWAY_QUEUE) { |
4412 | 275 gtk_widget_show(awayqueuesw); |
276 gtk_widget_show(awayqueue); | |
1773 | 277 } |
278 | |
5024 | 279 back = gaim_pixbuf_button_from_stock(_("I'm Back!"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
280 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
281 g_signal_connect(GTK_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway); |
1 | 282 gtk_window_set_focus(GTK_WINDOW(imaway), back); |
5024 | 283 gtk_widget_show(back); |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
284 |
1 | 285 awaymessage = a; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
286 } else { |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
287 destroy_im_away(); |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
288 do_away_message(w, a); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
289 return; |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
290 } |
1 | 291 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
292 /* New away message... Clear out the old sent_aways */ |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
293 while (away_time_queue) { |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
294 struct queued_away_response *qar = away_time_queue->data; |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
295 away_time_queue = g_slist_remove(away_time_queue, qar); |
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
296 g_free(qar); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
297 } |
1 | 298 |
1779
0da2a831c0ae
[gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1775
diff
changeset
|
299 gtk_widget_show(imaway); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
300 buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
301 strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
302 serv_set_away_all(buf2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
303 g_free(buf2); |
1 | 304 } |
305 | |
306 void rem_away_mess(GtkWidget *w, struct away_message *a) | |
307 { | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
308 int default_index; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
309 default_index = g_slist_index(away_messages, default_away); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
310 if (default_index == -1) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
311 if (away_messages != NULL) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
312 default_away = away_messages->data; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
313 else |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
314 default_away = NULL; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
315 } |
1306
868f9c98db13
[gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1292
diff
changeset
|
316 away_messages = g_slist_remove(away_messages, a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
317 g_free(a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
318 do_away_menu(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
319 save_prefs(); |
1 | 320 } |
321 | |
4635 | 322 static void set_gc_away(GObject *obj, struct gaim_connection *gc) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
323 { |
4635 | 324 struct away_message *awy = g_object_get_data(obj, "away_message"); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
325 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
326 if (awy) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
327 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
328 else |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
329 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
330 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
331 |
4635 | 332 static void set_gc_state(GObject *obj, struct gaim_connection *gc) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
333 { |
4635 | 334 char *awy = g_object_get_data(obj, "away_state"); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
335 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
336 serv_set_away(gc, awy, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
337 } |
1 | 338 |
339 void do_away_menu() | |
340 { | |
341 GtkWidget *menuitem; | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
342 GtkWidget *remmenu; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
343 GtkWidget *submenu, *submenu2; |
1 | 344 GtkWidget *remitem; |
345 GtkWidget *sep; | |
346 GList *l; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
347 GSList *awy = away_messages; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
348 struct away_message *a; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
349 GSList *con = connections; |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
350 struct gaim_connection *gc = NULL; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
351 int count = 0; |
1 | 352 |
4635 | 353 if (prefs_away_store != NULL) { |
354 gtk_list_store_clear(prefs_away_store); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
355 while (awy) { |
4635 | 356 GtkTreeIter iter; |
1 | 357 a = (struct away_message *)awy->data; |
4635 | 358 gtk_list_store_append(prefs_away_store, &iter); |
359 gtk_list_store_set(prefs_away_store, &iter, | |
360 0, a->name, | |
361 1, a, | |
362 -1); | |
940 | 363 awy = g_slist_next(awy); |
1 | 364 } |
365 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
366 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
367 if (awaymenu) { |
4635 | 368 l = gtk_container_get_children(GTK_CONTAINER(awaymenu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
369 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
370 while (l) { |
1530
0b6e4d52de63
[gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
371 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data)); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
372 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
373 } |
1 | 374 |
375 | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
376 remmenu = gtk_menu_new(); |
1 | 377 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
378 menuitem = gtk_menu_item_new_with_label(_("New Away Message")); |
4635 | 379 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
380 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
381 g_signal_connect(GTK_OBJECT(menuitem), "activate", G_CALLBACK(create_away_mess), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
382 NULL); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
383 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
384 awy = away_messages; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
385 while (awy) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
386 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
387 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
388 remitem = gtk_menu_item_new_with_label(a->name); |
4635 | 389 gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), remitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
390 gtk_widget_show(remitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
391 g_signal_connect(GTK_OBJECT(remitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
392 G_CALLBACK(rem_away_mess), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
393 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
394 awy = g_slist_next(awy); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
395 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
396 } |
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 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); |
4635 | 399 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1 | 400 gtk_widget_show(menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
401 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
402 gtk_widget_show(remmenu); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
403 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
404 sep = gtk_hseparator_new(); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
405 menuitem = gtk_menu_item_new(); |
4635 | 406 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
407 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
408 gtk_widget_set_sensitive(menuitem, FALSE); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
409 gtk_widget_show(menuitem); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
410 gtk_widget_show(sep); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
411 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
412 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
413 gc = con->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
414 if (gc->prpl->away_states &&gc->prpl->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
415 count++; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
416 con = g_slist_next(con); |
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 con = connections; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
419 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
420 if (count == 0) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
421 } else if (count == 1) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
422 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
423 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
424 gc = con->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
425 if (gc->prpl->away_states &&gc->prpl->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
426 break; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
427 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
428 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
429 |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2640
diff
changeset
|
430 tmp = msgs = gc->prpl->away_states(gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
431 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
432 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
|
433 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
434 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
435 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
436 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
437 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
438 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 439 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
440 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
441 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
442 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
443 G_CALLBACK(do_away_message), a); |
1401
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 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
446 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
447 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
448 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
449 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
450 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
451 menuitem = gtk_menu_item_new_with_label(msgs->data); |
4635 | 452 g_object_set_data(G_OBJECT(menuitem), "away_state", msgs->data); |
453 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
454 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
455 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
456 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
457 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
458 G_CALLBACK(set_gc_state), gc); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
459 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
460 submenu = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
461 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
462 submenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
463 gtk_widget_show(submenu); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
464 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
465 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
466 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
467 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
468 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 469 g_object_set_data(G_OBJECT(menuitem), "away_message", |
470 a); | |
471 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), | |
472 menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
473 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
474 g_signal_connect(GTK_OBJECT(menuitem), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
475 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
476 G_CALLBACK |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
477 (do_away_message), a); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
478 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
479 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
480 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
481 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
482 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
483 } |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
484 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
485 g_list_free(tmp); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
486 } else { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
487 while (con) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
488 char buf[256]; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
489 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
490 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
491 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
492 if (!gc->prpl->away_states ||!gc->prpl->set_away) { |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
493 con = con->next; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
494 continue; |
1545
34a5a436d04d
[gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
495 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
496 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
497 g_snprintf(buf, sizeof(buf), "%s (%s)", |
3572 | 498 gc->username, gc->prpl->name); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
499 menuitem = gtk_menu_item_new_with_label(buf); |
4635 | 500 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
501 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
502 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
503 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
504 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
505 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
506 |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2640
diff
changeset
|
507 tmp = msgs = gc->prpl->away_states(gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
508 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
509 if ((g_list_length(msgs) == 1) && |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
510 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
511 menuitem = gtk_menu_item_new_with_label(_("Back")); |
4635 | 512 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
513 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
514 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
515 G_CALLBACK(set_gc_away), gc); |
1401
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 sep = gtk_hseparator_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
518 menuitem = gtk_menu_item_new(); |
4635 | 519 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
520 gtk_container_add(GTK_CONTAINER(menuitem), sep); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
521 gtk_widget_set_sensitive(menuitem, FALSE); |
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_widget_show(sep); |
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 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
526 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
527 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
528 a = (struct away_message *)awy->data; |
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 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 531 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
532 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
533 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
534 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
535 G_CALLBACK(set_gc_away), gc); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
536 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
537 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
538 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
539 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
540 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
541 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
542 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
543 menuitem = gtk_menu_item_new_with_label(msgs->data); |
4635 | 544 g_object_set_data(G_OBJECT(menuitem), "away_state", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
545 msgs->data); |
4635 | 546 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
547 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
548 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
549 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
550 g_signal_connect(GTK_OBJECT(menuitem), |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
551 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
552 G_CALLBACK(set_gc_state), |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
553 gc); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
554 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
555 submenu2 = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
556 gtk_menu_item_set_submenu(GTK_MENU_ITEM |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
557 (menuitem), submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
558 gtk_widget_show(submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
559 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
560 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
561 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
562 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
563 menuitem = |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
564 gtk_menu_item_new_with_label(a-> |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
565 name); |
4635 | 566 g_object_set_data(G_OBJECT(menuitem), |
567 "away_message", a); | |
568 gtk_menu_shell_append(GTK_MENU_SHELL(submenu2), | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
569 menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
570 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
571 g_signal_connect(GTK_OBJECT(menuitem), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
572 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
573 G_CALLBACK |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
574 (set_gc_away), gc); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
575 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
576 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
577 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
578 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
579 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
580 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
581 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
582 g_list_free(tmp); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
583 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
584 con = g_slist_next(con); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
585 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
586 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
587 menuitem = gtk_menu_item_new_with_label(_("Set All Away")); |
4635 | 588 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
589 gtk_widget_show(menuitem); |
1401
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 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
592 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
593 gtk_widget_show(submenu); |
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 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
596 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
597 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
598 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
599 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
600 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 601 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
602 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
603 gtk_widget_show(menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
604 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
605 G_CALLBACK(do_away_message), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
606 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
607 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
608 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
609 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
610 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
611 if (prefs_away_menu) { |
4635 | 612 l = gtk_container_get_children(GTK_CONTAINER(prefs_away_menu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
613 while (l) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
614 gtk_widget_destroy(GTK_WIDGET(l->data)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
615 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
616 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
617 gtk_widget_hide(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
618 default_away_menu_init(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
619 gtk_widget_show(prefs_away_menu); |
1 | 620 } |
621 } |