annotate src/away.c @ 1621:cf2071b095ca

[gaim-migrate @ 1631] alt-[1-9] to get to pane [1-9] committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 19 Mar 2001 23:53:50 +0000
parents 3d3362903e1d
children 004725b3a851
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
22 #ifdef HAVE_CONFIG_H
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
23 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
24 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #ifdef USE_APPLET
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <gnome.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <applet-widget.h>
1261
07f0bb41bbe1 [gaim-migrate @ 1271]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1254
diff changeset
28 #include "applet.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #endif /* USE_APPLET */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include "gaim.h"
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
37 #include "prpl.h"
621
991bf4e3c9fe [gaim-migrate @ 631]
Todd Kulesza <fflewddur>
parents: 535
diff changeset
38 #include "pixmaps/join.xpm"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
40 GtkWidget *imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
42 GtkWidget *awaymenu = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 static void destroy_im_away()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 if (imaway)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 gtk_widget_destroy(imaway);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
51 imaway = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 void do_im_back(GtkWidget *w, GtkWidget *x)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 if (imaway) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
57 GtkWidget *tmp = imaway;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
58 imaway = NULL;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
59 gtk_widget_destroy(tmp);
1614
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
60 if (w != tmp)
3d3362903e1d [gaim-migrate @ 1624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1607
diff changeset
61 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
62 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
64 serv_set_away_all(NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 awaymessage = NULL;
1281
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
66 #ifdef USE_APPLET
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
67 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
68 set_user_state(online);
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
69 insert_applet_away();
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
70 #endif /* USE_APPLET */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
73
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74 void do_away_message(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 GtkWidget *back;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
77 GtkWidget *awaytext;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
78 GtkWidget *vscrollbar;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79 GtkWidget *vbox;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
80 char *buf2;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
81 char buf[BUF_LONG];
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
82 GList *cnv = conversations;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
83 struct conversation *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
85 if (!blist)
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
86 return;
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
87
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
88 if (!a)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
89 return;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
90
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91 if (!imaway) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92 imaway = gtk_window_new(GTK_WINDOW_DIALOG);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
93 gtk_window_set_wmclass(GTK_WINDOW(imaway), "imaway", "Gaim");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 gtk_widget_realize(imaway);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95 aol_icon(imaway->window);
621
991bf4e3c9fe [gaim-migrate @ 631]
Todd Kulesza <fflewddur>
parents: 535
diff changeset
96 back = picture_button(imaway, _("I'm Back!"), join_xpm);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
97 vbox = gtk_vbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
98 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
100 awaytext = gtk_text_new(NULL, NULL);
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
101
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
102 /* rcg10312000 Convert basic HTML (<BR>, etc) to plain text.
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
103 g_snprintf(buf, sizeof(buf), "%s", a->message);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
104 */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
105 strncpy_nohtml(buf, a->message, sizeof(buf));
1044
77b6bc7288d3 [gaim-migrate @ 1054]
Rob Flynn <gaim@robflynn.com>
parents: 1000
diff changeset
106
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
107 vscrollbar = gtk_vscrollbar_new(GTK_TEXT(awaytext)->vadj);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
108 gtk_widget_show(vscrollbar);
1185
47cf56b72d4b [gaim-migrate @ 1195]
Rob Flynn <gaim@robflynn.com>
parents: 1172
diff changeset
109 gtk_widget_set_usize(awaytext, 225, 100);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
110 gtk_text_set_word_wrap(GTK_TEXT(awaytext), TRUE);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
111 gtk_widget_show(awaytext);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
112 gtk_text_freeze(GTK_TEXT(awaytext));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
113 gtk_text_insert(GTK_TEXT(awaytext), NULL, NULL, NULL, buf, -1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
114 gtk_widget_show(awaytext);
1172
4135d8fc7b4e [gaim-migrate @ 1182]
Rob Flynn <gaim@robflynn.com>
parents: 1129
diff changeset
115
535
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
116 if (display_options & OPT_DISP_COOL_LOOK)
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
117 gtk_button_set_relief(GTK_BUTTON(back), GTK_RELIEF_NONE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
118
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
119 /* Put the buttons in the box */
1172
4135d8fc7b4e [gaim-migrate @ 1182]
Rob Flynn <gaim@robflynn.com>
parents: 1129
diff changeset
120 gtk_box_pack_start(GTK_BOX(vbox), awaytext, TRUE, TRUE, 0);
4135d8fc7b4e [gaim-migrate @ 1182]
Rob Flynn <gaim@robflynn.com>
parents: 1129
diff changeset
121 gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
122
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123 /* Handle closes right */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
124 gtk_signal_connect(GTK_OBJECT(imaway), "destroy", GTK_SIGNAL_FUNC(do_im_back), imaway);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
125 gtk_signal_connect(GTK_OBJECT(back), "clicked", GTK_SIGNAL_FUNC(do_im_back), imaway);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
127 /* Finish up */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128 gtk_widget_show(back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
129 gtk_widget_show(vbox);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
130 if (strlen(a->name))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 gtk_window_set_title(GTK_WINDOW(imaway), a->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
132 else
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
133 gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134 gtk_window_set_focus(GTK_WINDOW(imaway), back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 gtk_container_add(GTK_CONTAINER(imaway), vbox);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 awaymessage = a;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
138 } else {
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
139 destroy_im_away();
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
140 do_away_message(w, a);
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
141 return;
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
142 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143
1281
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
144 #ifdef USE_APPLET
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
145 remove_applet_away();
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
146 applet_widget_register_callback(APPLET_WIDGET(applet),
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
147 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL);
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
148 set_user_state(away);
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
149 #endif
83d8b2078f4c [gaim-migrate @ 1291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
150
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
151 /* New away message... Clear out the old sent_aways */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
152 while (cnv) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
153 c = (struct conversation *)cnv->data;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
154 c->sent_away = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
155 cnv = cnv->next;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
156 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
159 buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
160 strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
161 serv_set_away_all(buf2);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
162 g_free(buf2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
163 gtk_widget_show(imaway);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166 void rem_away_mess(GtkWidget *w, struct away_message *a)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
167 {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
168 int default_index;
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
169 #ifdef USE_APPLET
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
170 char *awayname;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
171 awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name)));
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
172 awayname[0] = '\0';
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
173 strcat(awayname, "away/");
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
174 strcat(awayname, a->name);
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
175 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname);
1129
282e6b7aef2c [gaim-migrate @ 1139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
176 g_free(awayname);
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
177 #endif
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
178 default_index = g_slist_index(away_messages, default_away);
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
179 if (default_index == -1) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
180 if (away_messages != NULL)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
181 default_away = away_messages->data;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
182 else
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
183 default_away = NULL;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
184 }
1306
868f9c98db13 [gaim-migrate @ 1316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1292
diff changeset
185 away_messages = g_slist_remove(away_messages, a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
186 g_free(a);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
187 do_away_menu();
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
188 save_prefs();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
189 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
190
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
191 static void set_gc_away(GtkObject *obj, struct gaim_connection *gc)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
192 {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
193 struct away_message *awy = gtk_object_get_user_data(obj);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
194
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
195 if (awy)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
196 serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
197 else
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
198 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
199 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
200
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
201 static void set_gc_state(GtkObject *obj, struct gaim_connection *gc)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
202 {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
203 char *awy = gtk_object_get_user_data(obj);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
204
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
205 serv_set_away(gc, awy, NULL);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
206 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
207
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
208 void do_away_menu()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
210 GtkWidget *menuitem;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
211 GtkWidget *remmenu;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
212 GtkWidget *submenu, *submenu2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
213 GtkWidget *remitem;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
215 GtkWidget *sep;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
216 GList *l;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
217 GtkWidget *list_item;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
218 GSList *awy = away_messages;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
219 struct away_message *a;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
220 GSList *con = connections;
1456
6650776468b3 [gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
221 struct gaim_connection *gc = NULL;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
222 int count = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
224 #ifdef USE_APPLET
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
225 remove_applet_away();
1591
5c74d8b6cb57 [gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
226 if (imaway && applet)
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
227 applet_widget_register_callback(APPLET_WIDGET(applet),
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
228 "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL);
1607
4ad4dac68317 [gaim-migrate @ 1617]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1591
diff changeset
229 else if (applet && !imaway)
1591
5c74d8b6cb57 [gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
230 insert_applet_away();
18
99d91a6c2fbf [gaim-migrate @ 27]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
231 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
233 if (prefs_away_list != NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
234 gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
235 while (awy) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
236 a = (struct away_message *)awy->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237 label = gtk_label_new(a->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238 list_item = gtk_list_item_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
239 gtk_container_add(GTK_CONTAINER(list_item), label);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
240 gtk_signal_connect(GTK_OBJECT(list_item), "select",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
241 GTK_SIGNAL_FUNC(away_list_clicked), a);
821
02250312c02d [gaim-migrate @ 831]
Todd Kulesza <fflewddur>
parents: 780
diff changeset
242 /* gtk_signal_connect(GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(away_list_unclicked), a);*/
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243 gtk_object_set_user_data(GTK_OBJECT(list_item), a);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245 gtk_widget_show(label);
652
4d3285caa191 [gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 621
diff changeset
246 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
247 gtk_widget_show(list_item);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
248
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 939
diff changeset
249 awy = g_slist_next(awy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
250 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251 if (away_messages != NULL)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
252 gtk_list_select_item(GTK_LIST(prefs_away_list), 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
254
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
255 if (awaymenu) {
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
256 l = gtk_container_children(GTK_CONTAINER(awaymenu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
257
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
258 while (l) {
1530
0b6e4d52de63 [gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
259 gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
260 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
261 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
262
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
264 remmenu = gtk_menu_new();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
266 menuitem = gtk_menu_item_new_with_label(_("New Away Message"));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
267 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
268 gtk_widget_show(menuitem);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
269 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(create_away_mess),
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
270 NULL);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
271
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
272 awy = away_messages;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
273 while (awy) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
274 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
275
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
276 remitem = gtk_menu_item_new_with_label(a->name);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
277 gtk_menu_append(GTK_MENU(remmenu), remitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
278 gtk_widget_show(remitem);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
279 gtk_signal_connect(GTK_OBJECT(remitem), "activate",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
280 GTK_SIGNAL_FUNC(rem_away_mess), a);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
281
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
282 awy = g_slist_next(awy);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
283
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
284 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
285
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
286 menuitem = gtk_menu_item_new_with_label(_("Remove Away Message"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
287 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 gtk_widget_show(menuitem);
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
289 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
290 gtk_widget_show(remmenu);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
291
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
292 sep = gtk_hseparator_new();
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
293 menuitem = gtk_menu_item_new();
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
294 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
295 gtk_container_add(GTK_CONTAINER(menuitem), sep);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
296 gtk_widget_set_sensitive(menuitem, FALSE);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
297 gtk_widget_show(menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
298 gtk_widget_show(sep);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
299
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
300 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
301 gc = con->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
302 if (gc->prpl->away_states && gc->prpl->set_away)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
303 count++;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
304 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
305 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
306 con = connections;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
307
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
308 if (count == 0) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
309 } else if (count == 1) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
310 GList *msgs, *tmp;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
311 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
312 gc = con->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
313 if (gc->prpl->away_states && gc->prpl->set_away)
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
314 break;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
315 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
316 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
317
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
318 tmp = msgs = (*gc->prpl->away_states)();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
319
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
320 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
321 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
322
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
323 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
324 a = (struct away_message *)awy->data;
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 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
327 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
328 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
329 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
330 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
331 GTK_SIGNAL_FUNC(do_away_message), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
332
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
333 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
334 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
335 } else while (msgs) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
336 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
337
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
338 menuitem = gtk_menu_item_new_with_label(msgs->data);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
339 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
340 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
341 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
342
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
343 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
344 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
345 GTK_SIGNAL_FUNC(set_gc_state), gc);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
346 } else {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
347 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
348 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
349 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
350
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
351 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
352 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
353
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
354 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
355 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
356 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
357 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
358 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
359 GTK_SIGNAL_FUNC(set_gc_away), gc);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
360
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
361 awy = g_slist_next(awy);
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 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
364 msgs = g_list_next(msgs);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
365 }
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
366
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
367 g_list_free(tmp);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
368 } else {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
369 while (con) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
370 char buf[256];
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
371 GList *msgs, *tmp;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
372 gc = con->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
373
1545
34a5a436d04d [gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
374 if (!gc->prpl->away_states || !gc->prpl->set_away) {
34a5a436d04d [gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
375 con = con->next;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
376 continue;
1545
34a5a436d04d [gaim-migrate @ 1555]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
377 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
378
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
379 g_snprintf(buf, sizeof(buf), "%s (%s)",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
380 gc->username, (*gc->prpl->name)());
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
381 menuitem = gtk_menu_item_new_with_label(buf);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
382 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
383 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
384
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
385 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
386 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
387 gtk_widget_show(submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
388
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
389 tmp = msgs = (*gc->prpl->away_states)();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
390
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
391 if ((g_list_length(msgs) == 1) &&
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
392 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
393 menuitem = gtk_menu_item_new_with_label(_("Back"));
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
394 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
395 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
396 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
397 GTK_SIGNAL_FUNC(set_gc_away), gc);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
398
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
399 sep = gtk_hseparator_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
400 menuitem = gtk_menu_item_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
401 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
402 gtk_container_add(GTK_CONTAINER(menuitem), sep);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
403 gtk_widget_set_sensitive(menuitem, FALSE);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
404 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
405 gtk_widget_show(sep);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
406
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
407 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
408
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
409 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
410 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
411
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
412 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
413 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
414 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
415 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
416 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
417 GTK_SIGNAL_FUNC(set_gc_away), gc);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
418
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
419 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
420 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
421 } else while (msgs) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
422 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
423
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
424 menuitem = gtk_menu_item_new_with_label(msgs->data);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
425 gtk_object_set_user_data(GTK_OBJECT(menuitem), msgs->data);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
426 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
427 gtk_widget_show(menuitem);
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 if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
430 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
431 GTK_SIGNAL_FUNC(set_gc_state), gc);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
432 } else {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
433 submenu2 = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
434 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
435 submenu2);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
436 gtk_widget_show(submenu2);
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 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
439 a = (struct away_message *)awy->data;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
440
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
441 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
442 gtk_object_set_user_data(GTK_OBJECT(menuitem),
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
443 a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
444 gtk_menu_append(GTK_MENU(submenu2), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
445 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
446 gtk_signal_connect(GTK_OBJECT(menuitem),
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
447 "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
448 GTK_SIGNAL_FUNC(set_gc_away),
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
449 gc);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
450
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
451 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
452 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
453 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
454 msgs = g_list_next(msgs);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
455 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
456
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
457 g_list_free(tmp);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
458
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
459 con = g_slist_next(con);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
460 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
461
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
462 menuitem = gtk_menu_item_new_with_label(_("Set All Away"));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
463 gtk_menu_append(GTK_MENU(awaymenu), menuitem);
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
464 gtk_widget_show(menuitem);
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
465
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
466 submenu = gtk_menu_new();
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
467 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
468 gtk_widget_show(submenu);
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 awy = away_messages;
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
471
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
472 while (awy) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
473 a = (struct away_message *)awy->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
474
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
475 menuitem = gtk_menu_item_new_with_label(a->name);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
476 gtk_object_set_user_data(GTK_OBJECT(menuitem), a);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
477 gtk_menu_append(GTK_MENU(submenu), menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
478 gtk_widget_show(menuitem);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
479 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
480 GTK_SIGNAL_FUNC(do_away_message), a);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
481
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
482 awy = g_slist_next(awy);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1306
diff changeset
483 }
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
484 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
485 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
486 if (prefs_away_menu) {
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
487 l = gtk_container_children(GTK_CONTAINER(prefs_away_menu));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1191
diff changeset
488 while (l) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
489 gtk_widget_destroy(GTK_WIDGET(l->data));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
490 l = l->next;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
491 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
492 gtk_widget_hide(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
493 default_away_menu_init(GTK_WIDGET(prefs_away_menu));
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1044
diff changeset
494 gtk_widget_show(prefs_away_menu);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
495 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
496
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
497 }