Mercurial > pidgin
annotate src/away.c @ 9625:3ec0b63d4f2e
[gaim-migrate @ 10469]
As far as I know oscar buddy comments are plain-text.
Fixes bug 999922.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 31 Jul 2004 23:08:52 +0000 |
parents | 03be9d653123 |
children | a049733e41f3 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
8046 | 4 * Gaim is the legal property of its developers, whose names are too numerous |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
1 | 7 * |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
21 * |
1 | 22 */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
23 #include "internal.h" |
1 | 24 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
25 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
26 #include "debug.h" |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
27 #include "plugin.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
28 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
29 #include "prpl.h" |
6727 | 30 #include "status.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
31 #include "util.h" |
8807 | 32 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
33 |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6284
diff
changeset
|
34 /* XXX CORE/UI: Until we can get rid of the message queue stuff... */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
35 #include "gaim.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6284
diff
changeset
|
36 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
37 #include "gtkblist.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
38 #include "gtkimhtml.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
39 #include "gtkprefs.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
40 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
41 #include "ui.h" |
1 | 42 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
43 GtkWidget *imaway = NULL; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
621
diff
changeset
|
44 GtkWidget *awaymenu = NULL; |
4412 | 45 GtkWidget *awayqueue = NULL; |
46 GtkListStore *awayqueuestore = NULL; | |
47 GtkWidget *awayqueuesw; | |
1773 | 48 |
6479 | 49 GSList *message_queue = NULL; |
50 GSList *unread_message_queue = NULL; | |
51 | |
52 GSList *away_messages = NULL; | |
1 | 53 struct away_message *awaymessage = NULL; |
54 | |
4412 | 55 static void dequeue_message(GtkTreeIter *iter) |
56 { | |
57 gchar *name; | |
58 GSList *templist; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5593
diff
changeset
|
59 GaimConversation *cnv; |
9550 | 60 gboolean orig_while_away; |
61 | |
62 orig_while_away = gaim_prefs_get_bool("/core/sound/while_away"); | |
63 if (orig_while_away) | |
64 gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
4412 | 65 |
66 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1); | |
4491 | 67 |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8413
diff
changeset
|
68 gaim_debug(GAIM_DEBUG_INFO, "away", "Dequeueing messages from %s.\n", |
5213
1cf4eb75e3ee
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
69 name); |
4491 | 70 |
4412 | 71 templist = message_queue; |
4491 | 72 |
4412 | 73 while (templist) { |
74 struct queued_message *qm = templist->data; | |
75 if (templist->data) { | |
4793 | 76 if (!gaim_utf8_strcasecmp(qm->name, name)) { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
77 GaimAccount *account = NULL; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
78 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
79 if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0) |
4608 | 80 account = qm->account; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
81 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
82 cnv = gaim_find_conversation_with_account(name, account); |
4412 | 83 |
84 if (!cnv) | |
4491 | 85 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
86 else |
4491 | 87 gaim_conversation_set_account(cnv, account); |
4412 | 88 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
89 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, qm->message, |
4412 | 90 qm->flags, qm->tm); |
91 g_free(qm->message); | |
92 g_free(qm); | |
93 templist = message_queue = g_slist_remove(message_queue, qm); | |
4491 | 94 |
4412 | 95 } else { |
96 templist = templist->next; | |
97 } | |
98 } | |
99 } | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
100 |
4412 | 101 g_free(name); |
102 /* In GTK 2.2, _store_remove actually returns whether iter is valid or not | |
103 * after the remove, but in GTK 2.0 it is a void function. */ | |
104 gtk_list_store_remove(awayqueuestore, iter); | |
9550 | 105 |
106 if (orig_while_away) | |
107 gaim_prefs_set_bool("/core/sound/while_away", orig_while_away); | |
4412 | 108 } |
109 | |
4274 | 110 void purge_away_queue(GSList **queue) |
1773 | 111 { |
4274 | 112 GSList *q = *queue; |
113 struct queued_message *qm; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5593
diff
changeset
|
114 GaimConversation *cnv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
115 GaimAccount *account; |
9550 | 116 gboolean orig_while_away; |
117 | |
118 orig_while_away = gaim_prefs_get_bool("/core/sound/while_away"); | |
119 if (orig_while_away) | |
120 gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1773 | 121 |
4274 | 122 while (q) { |
123 qm = q->data; | |
4167 | 124 |
4491 | 125 account = NULL; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
126 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
127 if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0) |
4608 | 128 account = qm->account; |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
129 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
130 cnv = gaim_find_conversation_with_account(qm->name, account); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
131 |
4167 | 132 if (!cnv) |
4491 | 133 cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4412
diff
changeset
|
134 else |
4491 | 135 gaim_conversation_set_account(cnv, account); |
4274 | 136 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
137 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, qm->message, qm->flags, qm->tm); |
4167 | 138 |
139 g_free(qm->message); | |
140 g_free(qm); | |
4274 | 141 |
142 q->data = NULL; | |
143 q = q->next; | |
4167 | 144 } |
145 | |
4274 | 146 g_slist_free(*queue); |
147 *queue = NULL; | |
9550 | 148 |
149 if (orig_while_away) | |
150 gaim_prefs_set_bool("/core/sound/while_away", orig_while_away); | |
4167 | 151 } |
152 | |
4412 | 153 gint dequeue_cb(GtkWidget *treeview, GdkEventButton *event, gpointer data) { |
154 GtkTreeIter iter; | |
155 GtkTreeSelection *select; | |
4491 | 156 |
4167 | 157 if(!(event->type == GDK_2BUTTON_PRESS && event->button == 1)) |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8413
diff
changeset
|
158 return FALSE; /* Double clicking on the list will dequeue that user's messages. */ |
4491 | 159 |
4412 | 160 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
161 if(gtk_tree_selection_get_selected(select, NULL, &iter)) | |
162 dequeue_message(&iter); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4274
diff
changeset
|
163 |
4412 | 164 return FALSE; |
4167 | 165 } |
4491 | 166 |
2573 | 167 |
168 | |
1773 | 169 void toggle_away_queue() |
170 { | |
4412 | 171 if (!awayqueue || !awayqueuesw) |
1773 | 172 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
173 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
174 if (gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
4412 | 175 gtk_widget_show(awayqueue); |
176 gtk_widget_show(awayqueuesw); | |
1775
9ca22174da76
[gaim-migrate @ 1785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
177 } else { |
4412 | 178 gtk_widget_hide(awayqueue); |
179 gtk_widget_hide(awayqueuesw); | |
4274 | 180 purge_away_queue(&message_queue); |
1773 | 181 } |
182 } | |
183 | |
1 | 184 void do_im_back(GtkWidget *w, GtkWidget *x) |
185 { | |
186 if (imaway) { | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
187 GtkWidget *tmp = imaway; |
1768 | 188 |
4274 | 189 purge_away_queue(&message_queue); |
190 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
191 imaway = NULL; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
192 gtk_widget_destroy(tmp); |
1614
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
193 if (w != tmp) |
3d3362903e1d
[gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1607
diff
changeset
|
194 return; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
195 } |
1 | 196 |
197 awaymessage = NULL; | |
4412 | 198 awayqueue = NULL; |
199 awayqueuesw = NULL; | |
200 g_object_unref(G_OBJECT(awayqueuestore)); | |
201 awayqueuestore = NULL; | |
3514 | 202 serv_set_away_all(NULL); |
1 | 203 } |
204 | |
1044 | 205 |
1 | 206 void do_away_message(GtkWidget *w, struct away_message *a) |
207 { | |
208 GtkWidget *back; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
209 GtkWidget *awaytext; |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
210 GtkWidget *sw; |
1 | 211 GtkWidget *vbox; |
4412 | 212 GtkTreeViewColumn *column; |
213 GtkCellRenderer *renderer; | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
214 char *buf; |
1 | 215 |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
216 if (!a) |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
217 return; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
218 |
6284 | 219 if(imaway) |
220 gtk_widget_destroy(imaway); | |
221 | |
222 GAIM_DIALOG(imaway); | |
223 gtk_window_set_role(GTK_WINDOW(imaway), "imaway"); | |
224 if (strlen(a->name)) | |
225 gtk_window_set_title(GTK_WINDOW(imaway), a->name); | |
226 else | |
7859 | 227 gtk_window_set_title(GTK_WINDOW(imaway), _("Away!")); |
6284 | 228 g_signal_connect(G_OBJECT(imaway), "destroy", |
229 G_CALLBACK(do_im_back), imaway); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
230 |
6284 | 231 vbox = gtk_vbox_new(FALSE, 5); |
232 gtk_container_add(GTK_CONTAINER(imaway), vbox); | |
233 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
234 gtk_widget_show(vbox); | |
1044 | 235 |
6284 | 236 sw = gtk_scrolled_window_new(NULL, NULL); |
237 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, | |
8973 | 238 GTK_POLICY_AUTOMATIC); |
6284 | 239 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
240 gtk_widget_set_size_request(sw, 245, 120); | |
241 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
242 gtk_widget_show(sw); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
243 |
6284 | 244 awaytext = gtk_imhtml_new(NULL, NULL); |
245 gtk_container_add(GTK_CONTAINER(sw), awaytext); | |
246 gaim_setup_imhtml(awaytext); | |
247 gtk_widget_show(awaytext); | |
248 buf = stylize(a->message, BUF_LONG); | |
6982 | 249 gtk_imhtml_append_text(GTK_IMHTML(awaytext), buf, GTK_IMHTML_NO_TITLE | |
6284 | 250 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
251 g_free(buf); | |
6982 | 252 gtk_imhtml_append_text(GTK_IMHTML(awaytext), "<BR>", |
6284 | 253 GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_COMMENTS | |
254 GTK_IMHTML_NO_SCROLL); | |
1773 | 255 |
6284 | 256 awayqueuesw = gtk_scrolled_window_new(NULL, NULL); |
257 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(awayqueuesw), | |
258 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
259 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(awayqueuesw), | |
260 GTK_SHADOW_IN); | |
261 gtk_box_pack_start(GTK_BOX(vbox), awayqueuesw, TRUE, TRUE, 0); | |
262 | |
8413
f5b0e1a4b0c7
[gaim-migrate @ 9143]
Christian Hammond <chipx86@chipx86.com>
parents:
8235
diff
changeset
|
263 awayqueuestore = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
6284 | 264 awayqueue = gtk_tree_view_new_with_model(GTK_TREE_MODEL(awayqueuestore)); |
265 renderer = gtk_cell_renderer_text_new(); | |
266 | |
267 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(awayqueue), FALSE); | |
268 column = gtk_tree_view_column_new_with_attributes (NULL, renderer, | |
269 "text", 0, | |
270 NULL); | |
271 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column); | |
272 column = gtk_tree_view_column_new_with_attributes(NULL, renderer, | |
273 "text", 1, | |
274 NULL); | |
275 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column); | |
8413
f5b0e1a4b0c7
[gaim-migrate @ 9143]
Christian Hammond <chipx86@chipx86.com>
parents:
8235
diff
changeset
|
276 column = gtk_tree_view_column_new_with_attributes(NULL, renderer, |
f5b0e1a4b0c7
[gaim-migrate @ 9143]
Christian Hammond <chipx86@chipx86.com>
parents:
8235
diff
changeset
|
277 "text", 2, |
f5b0e1a4b0c7
[gaim-migrate @ 9143]
Christian Hammond <chipx86@chipx86.com>
parents:
8235
diff
changeset
|
278 NULL); |
f5b0e1a4b0c7
[gaim-migrate @ 9143]
Christian Hammond <chipx86@chipx86.com>
parents:
8235
diff
changeset
|
279 gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column); |
6284 | 280 |
281 gtk_container_add(GTK_CONTAINER(awayqueuesw), awayqueue); | |
282 | |
283 g_signal_connect(G_OBJECT(awayqueue), "button_press_event", G_CALLBACK(dequeue_cb), NULL); | |
2573 | 284 |
1773 | 285 |
6284 | 286 if (gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
287 gtk_widget_show(awayqueuesw); | |
288 gtk_widget_show(awayqueue); | |
289 } | |
1773 | 290 |
6284 | 291 back = gaim_pixbuf_button_from_stock(_("I'm Back!"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL); |
292 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); | |
293 g_signal_connect(G_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway); | |
294 gtk_window_set_focus(GTK_WINDOW(imaway), back); | |
295 gtk_widget_show(back); | |
1888
dedcd9e6f3e8
[gaim-migrate @ 1898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
296 |
6284 | 297 awaymessage = a; |
1 | 298 |
1779
0da2a831c0ae
[gaim-migrate @ 1789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1775
diff
changeset
|
299 gtk_widget_show(imaway); |
6019 | 300 serv_set_away_all(awaymessage->message); |
1 | 301 } |
302 | |
8807 | 303 void do_rem_away_mess(gchar *name) |
1 | 304 { |
8820 | 305 struct away_message *a = NULL; |
6216 | 306 struct away_message *default_away = NULL; |
307 const char *default_away_name; | |
308 GSList *l; | |
309 | |
8807 | 310 /* Lookup the away message based on the title */ |
311 for (l = away_messages; l != NULL; l = l->next) { | |
312 a = l->data; | |
313 if (!strcmp(a->name, name)) | |
314 break; | |
315 } | |
316 g_free(name); | |
317 | |
8820 | 318 if (l == NULL || a == NULL) { |
8807 | 319 /* Could not find away message! */ |
320 return; | |
321 } | |
322 | |
6216 | 323 default_away_name = gaim_prefs_get_string("/core/away/default_message"); |
324 | |
325 for(l = away_messages; l; l = l->next) { | |
326 if(!strcmp(default_away_name, ((struct away_message *)l->data)->name)) { | |
327 default_away = l->data; | |
328 break; | |
329 } | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
330 } |
6216 | 331 |
332 if(!default_away && away_messages) | |
333 default_away = away_messages->data; | |
334 | |
1306
868f9c98db13
[gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1292
diff
changeset
|
335 away_messages = g_slist_remove(away_messages, a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
336 g_free(a); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
337 do_away_menu(); |
6727 | 338 gaim_status_sync(); |
1 | 339 } |
340 | |
8807 | 341 void rem_away_mess(GtkWidget *w, struct away_message *a) |
342 { | |
343 gchar *text; | |
344 | |
345 text = g_strdup_printf(_("Are you sure you want to remove the away message \"%s\"?"), a->name); | |
346 | |
347 gaim_request_action(NULL, NULL, _("Remove Away Message"), text, -1, g_strdup(a->name), 2, | |
348 _("Remove"), G_CALLBACK(do_rem_away_mess), | |
349 _("Cancel"), G_CALLBACK(g_free)); | |
350 | |
351 g_free(text); | |
352 } | |
353 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
354 static void set_gc_away(GObject *obj, GaimConnection *gc) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
355 { |
4635 | 356 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
|
357 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
358 if (awy) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
359 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
360 else |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
361 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
362 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
363 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
364 static void set_gc_state(GObject *obj, GaimConnection *gc) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
365 { |
4635 | 366 char *awy = g_object_get_data(obj, "away_state"); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
367 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
368 serv_set_away(gc, awy, NULL); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
369 } |
1 | 370 |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
371 /* XXX This needs to be fixed, NOW! */ |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
372 extern GtkListStore *prefs_away_store; |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
373 extern GtkWidget *prefs_away_menu; |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
374 |
1 | 375 void do_away_menu() |
376 { | |
377 GtkWidget *menuitem; | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
378 GtkWidget *remmenu; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
379 GtkWidget *submenu, *submenu2; |
1 | 380 GtkWidget *remitem; |
5160 | 381 GtkWidget *image; |
382 GdkPixbuf *pixbuf, *scale; | |
1 | 383 GList *l; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
384 GSList *awy = away_messages; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
385 struct away_message *a; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
386 GList *con; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
387 GaimConnection *gc = NULL; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
388 GaimPluginProtocolInfo *prpl_info = NULL; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
389 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
390 int count = 0; |
1 | 391 |
4635 | 392 if (prefs_away_store != NULL) { |
393 gtk_list_store_clear(prefs_away_store); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
394 while (awy) { |
4635 | 395 GtkTreeIter iter; |
1 | 396 a = (struct away_message *)awy->data; |
4635 | 397 gtk_list_store_append(prefs_away_store, &iter); |
398 gtk_list_store_set(prefs_away_store, &iter, | |
399 0, a->name, | |
400 1, a, | |
401 -1); | |
940 | 402 awy = g_slist_next(awy); |
1 | 403 } |
404 } | |
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 if (awaymenu) { |
4635 | 407 l = gtk_container_get_children(GTK_CONTAINER(awaymenu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
408 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
409 while (l) { |
1530
0b6e4d52de63
[gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
410 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data)); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
411 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
412 } |
1 | 413 |
8235 | 414 g_list_free(l); |
1 | 415 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
416 remmenu = gtk_menu_new(); |
1 | 417 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
418 menuitem = gtk_menu_item_new_with_label(_("New Away Message")); |
4635 | 419 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
420 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
421 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(create_away_mess), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
422 NULL); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
423 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
424 awy = away_messages; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
425 while (awy) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
426 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
427 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
428 remitem = gtk_menu_item_new_with_label(a->name); |
4635 | 429 gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), remitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
430 gtk_widget_show(remitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
431 g_signal_connect(G_OBJECT(remitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
432 G_CALLBACK(rem_away_mess), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
433 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
434 awy = g_slist_next(awy); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
435 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
436 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
437 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
438 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); |
4635 | 439 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1 | 440 gtk_widget_show(menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
441 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
442 gtk_widget_show(remmenu); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
443 |
5160 | 444 gaim_separator(awaymenu); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
445 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
446 for (con = gaim_connections_get_all(); con != NULL; con = con->next) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
447 gc = con->data; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
448 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
449 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
450 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
451 if (prpl_info->away_states != NULL && prpl_info->set_away != NULL) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
452 count++; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
453 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
454 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
455 if (count == 0) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
456 } else if (count == 1) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
457 GList *msgs, *tmp; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
458 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
459 for (con = gaim_connections_get_all(); con != NULL; con = con->next) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
460 gc = con->data; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
461 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
462 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
463 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
464 if (prpl_info->away_states && prpl_info->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
465 break; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
466 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
467 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
468 tmp = msgs = prpl_info->away_states(gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
469 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
470 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
|
471 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
472 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
473 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
474 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
475 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
476 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 477 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
478 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
479 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
480 g_signal_connect(G_OBJECT(menuitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
481 G_CALLBACK(do_away_message), a); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
482 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
483 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
484 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
485 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
486 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
487 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
488 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
489 menuitem = gtk_menu_item_new_with_label(msgs->data); |
4635 | 490 g_object_set_data(G_OBJECT(menuitem), "away_state", msgs->data); |
491 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
492 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
493 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
494 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
495 g_signal_connect(G_OBJECT(menuitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
496 G_CALLBACK(set_gc_state), gc); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
497 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
498 submenu = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
499 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
500 submenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
501 gtk_widget_show(submenu); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
502 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
503 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
504 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
505 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
506 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 507 g_object_set_data(G_OBJECT(menuitem), "away_message", |
508 a); | |
509 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), | |
510 menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
511 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
512 g_signal_connect(G_OBJECT(menuitem), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
513 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
514 G_CALLBACK |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
515 (do_away_message), a); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
516 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
517 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
518 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
519 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
520 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
521 } |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
522 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
523 g_list_free(tmp); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
524 } |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
525 else { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
526 for (con = gaim_connections_get_all(); con != NULL; con = con->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
527 GaimAccount *account; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
528 char buf[256]; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
529 GList *msgs, *tmp; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
530 gc = con->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
531 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
532 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
533 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
534 if (!prpl_info->away_states || !prpl_info->set_away) |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
535 continue; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
536 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
537 account = gaim_connection_get_account(gc); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
538 |
5161 | 539 g_snprintf(buf, sizeof(buf), "%s (%s)", |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
540 gaim_account_get_username(account), gc->prpl->info->name); |
5161 | 541 menuitem = gtk_image_menu_item_new_with_label(buf); |
542 | |
5160 | 543 pixbuf = create_prpl_icon(gc->account); |
544 if (pixbuf) { | |
545 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); | |
546 image = gtk_image_new_from_pixbuf(scale); | |
547 g_object_unref(G_OBJECT(pixbuf)); | |
548 g_object_unref(G_OBJECT(scale)); | |
5161 | 549 gtk_widget_show(image); |
550 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), | |
551 image); | |
5160 | 552 } |
553 | |
4635 | 554 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
555 gtk_widget_show(menuitem); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
556 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
557 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
558 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
559 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
560 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
561 tmp = msgs = prpl_info->away_states(gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
562 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
563 if ((g_list_length(msgs) == 1) && |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
564 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
565 menuitem = gtk_menu_item_new_with_label(_("Back")); |
4635 | 566 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
567 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
568 g_signal_connect(G_OBJECT(menuitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
569 G_CALLBACK(set_gc_away), gc); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
570 |
5160 | 571 gaim_separator(submenu); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
572 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
573 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
574 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
575 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
576 a = (struct away_message *)awy->data; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
577 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
578 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 579 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
580 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
581 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
582 g_signal_connect(G_OBJECT(menuitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
583 G_CALLBACK(set_gc_away), gc); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
584 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
585 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
586 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
587 } else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
588 while (msgs) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
589 awy = away_messages; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
590 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
591 menuitem = gtk_menu_item_new_with_label(msgs->data); |
4635 | 592 g_object_set_data(G_OBJECT(menuitem), "away_state", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
593 msgs->data); |
4635 | 594 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
595 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
596 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
597 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
598 g_signal_connect(G_OBJECT(menuitem), |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
599 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
600 G_CALLBACK(set_gc_state), |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
601 gc); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
602 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
603 submenu2 = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
604 gtk_menu_item_set_submenu(GTK_MENU_ITEM |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
605 (menuitem), submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
606 gtk_widget_show(submenu2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
607 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
608 while (awy) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
609 a = (struct away_message *)awy->data; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
610 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
611 menuitem = |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
612 gtk_menu_item_new_with_label(a-> |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
613 name); |
4635 | 614 g_object_set_data(G_OBJECT(menuitem), |
615 "away_message", a); | |
616 gtk_menu_shell_append(GTK_MENU_SHELL(submenu2), | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
617 menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
618 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
619 g_signal_connect(G_OBJECT(menuitem), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
620 "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
621 G_CALLBACK |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
622 (set_gc_away), gc); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
623 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
624 awy = g_slist_next(awy); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
625 } |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
626 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
627 msgs = g_list_next(msgs); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
628 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
629 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
630 g_list_free(tmp); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
631 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
632 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
633 menuitem = gtk_menu_item_new_with_label(_("Set All Away")); |
4635 | 634 gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
635 gtk_widget_show(menuitem); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
636 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
637 submenu = gtk_menu_new(); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
638 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
639 gtk_widget_show(submenu); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
640 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
641 awy = away_messages; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
642 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
643 while (awy) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
644 a = (struct away_message *)awy->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
645 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
646 menuitem = gtk_menu_item_new_with_label(a->name); |
4635 | 647 g_object_set_data(G_OBJECT(menuitem), "away_message", a); |
648 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
649 gtk_widget_show(menuitem); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
650 g_signal_connect(G_OBJECT(menuitem), "activate", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4124
diff
changeset
|
651 G_CALLBACK(do_away_message), a); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
652 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
653 awy = g_slist_next(awy); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1306
diff
changeset
|
654 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
655 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
656 } |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
657 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
658 if (prefs_away_menu) { |
4635 | 659 l = gtk_container_get_children(GTK_CONTAINER(prefs_away_menu)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1191
diff
changeset
|
660 while (l) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
661 gtk_widget_destroy(GTK_WIDGET(l->data)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
662 l = l->next; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
663 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
664 gtk_widget_hide(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
665 default_away_menu_init(GTK_WIDGET(prefs_away_menu)); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1044
diff
changeset
|
666 gtk_widget_show(prefs_away_menu); |
1 | 667 } |
668 } |