Mercurial > pidgin
annotate src/buddy.c @ 778:035d3115c6fe
[gaim-migrate @ 788]
fflush(stdout);
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 29 Aug 2000 01:07:42 +0000 |
parents | b61607d6c2af |
children | c714def9cebb |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
26 #include <gnome.h> | |
27 #include <applet-widget.h> | |
84 | 28 #include "gnome_applet_mgr.h" |
1 | 29 #endif /* USE_APPLET */ |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
30 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
31 #include <dlfcn.h> |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
32 #endif /* GAIM_PLUGINS */ |
1 | 33 #include <string.h> |
34 #include <stdio.h> | |
35 #include <stdlib.h> | |
36 #include <math.h> | |
37 #include <time.h> | |
38 | |
39 #include <gtk/gtk.h> | |
40 #include <gdk/gdkx.h> | |
41 #include "gaim.h" | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
42 #include <aim.h> |
1 | 43 #include "pixmaps/admin_icon.xpm" |
44 #include "pixmaps/aol_icon.xpm" | |
45 #include "pixmaps/free_icon.xpm" | |
46 #include "pixmaps/dt_icon.xpm" | |
47 #include "pixmaps/no_icon.xpm" | |
48 #include "pixmaps/login_icon.xpm" | |
49 #include "pixmaps/logout_icon.xpm" | |
50 | |
51 #include "pixmaps/buddyadd.xpm" | |
52 #include "pixmaps/buddydel.xpm" | |
53 #include "pixmaps/buddychat.xpm" | |
54 #include "pixmaps/im.xpm" | |
55 #include "pixmaps/info.xpm" | |
56 #include "pixmaps/away_icon.xpm" | |
57 | |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
58 #include "pixmaps/daemon-buddyadd.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
59 #include "pixmaps/daemon-buddydel.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
60 #include "pixmaps/daemon-buddychat.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
61 #include "pixmaps/daemon-im.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
62 #include "pixmaps/daemon-info.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
63 |
714 | 64 #include "pixmaps/add_small.xpm" |
718 | 65 #include "pixmaps/import_small.xpm" |
733 | 66 #include "pixmaps/export_small.xpm" |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
67 #ifdef USE_APPLET |
727 | 68 #include "pixmaps/close_small.xpm" |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
69 #endif |
727 | 70 #include "pixmaps/exit_small.xpm" |
714 | 71 |
1 | 72 static GtkTooltips *tips; |
73 static GtkWidget *editpane; | |
74 static GtkWidget *buddypane; | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
75 static GtkWidget *imchatbox; |
1 | 76 static GtkWidget *edittree; |
77 static GtkWidget *imbutton, *infobutton, *chatbutton; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
78 static GtkWidget *addbutton, *groupbutton, *rembutton; |
1 | 79 |
436 | 80 extern int ticker_prefs; |
1 | 81 |
82 GtkWidget *blist = NULL; | |
83 GtkWidget *bpmenu; | |
84 GtkWidget *buddies; | |
85 int permdeny; | |
86 | |
430 | 87 void BuddyTickerLogonTimeout( gpointer data ); |
88 void BuddyTickerLogoutTimeout( gpointer data ); | |
1 | 89 |
90 /* Predefine some functions */ | |
91 static void new_bp_callback(GtkWidget *w, char *name); | |
92 static void log_callback(GtkWidget *w, char *name); | |
93 | |
94 | |
95 void destroy_buddy() | |
96 { | |
97 if (blist) | |
98 gtk_widget_destroy(blist); | |
99 blist=NULL; | |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
100 imchatbox = NULL; |
1 | 101 } |
102 | |
103 void update_num_groups() | |
104 { | |
105 GList *grp = groups; | |
106 GList *mem; | |
107 struct buddy *b; | |
108 struct group *g; | |
109 int pres, total; | |
110 char buf[BUF_LONG]; | |
111 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
112 #ifndef USE_APPLET |
1 | 113 if (!(display_options & OPT_DISP_SHOW_GRPNUM)) |
114 return; | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
115 #else |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
116 int onl = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
117 int all = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
118 #endif |
1 | 119 |
120 while(grp) { | |
121 g = (struct group *)grp->data; | |
122 mem = g->members; | |
123 pres = 0; | |
124 total = 0; | |
125 while(mem) { | |
126 b = (struct buddy *)mem->data; | |
127 if (b->present) | |
128 pres++; | |
129 total++; | |
130 | |
131 | |
132 mem = mem->next; | |
133 } | |
134 | |
135 g_snprintf(buf, sizeof(buf), "%s (%d/%d)", g->name, pres, total); | |
136 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
137 #ifdef USE_APPLET |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
138 onl += pres; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
139 all += total; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
140 if (display_options & OPT_DISP_SHOW_GRPNUM) |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
141 #endif |
1 | 142 gtk_label_set(GTK_LABEL(g->label), buf); |
143 grp = grp->next; | |
144 } | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
145 #ifdef USE_APPLET |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
146 g_snprintf(buf, sizeof(buf), _("%d/%d Buddies Online"), onl, all); |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
147 applet_set_tooltips(buf); |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
148 #endif |
1 | 149 } |
150 | |
151 void update_show_idlepix() | |
152 { | |
153 GList *grp = groups; | |
154 GList *mem; | |
155 struct group *g; | |
156 struct buddy *b; | |
157 | |
158 while (grp) { | |
159 g = (struct group *)grp->data; | |
160 mem = g->members; | |
161 | |
162 while(mem) { | |
163 b = (struct buddy *)mem->data; | |
164 | |
165 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
166 gtk_widget_show(b->idletime); | |
167 else | |
168 gtk_widget_hide(b->idletime); | |
169 | |
170 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
171 gtk_widget_show(b->pix); | |
172 else | |
173 gtk_widget_hide(b->pix); | |
174 mem = mem->next; | |
175 } | |
176 grp = grp->next; | |
177 } | |
178 } | |
179 | |
180 void update_all_buddies() | |
181 { | |
182 GList *grp = groups; | |
183 GList *mem; | |
184 struct buddy *b; | |
185 struct group *g; | |
186 | |
187 while(grp) { | |
188 g = (struct group *)grp->data; | |
189 mem = g->members; | |
190 while(mem) { | |
191 b = (struct buddy *)mem->data; | |
192 | |
59 | 193 if (b->present || !GTK_WIDGET_VISIBLE(b->item)) |
194 set_buddy(b); | |
1 | 195 |
196 mem = mem->next; | |
197 } | |
198 grp = grp->next; | |
199 } | |
200 | |
201 | |
202 } | |
203 | |
204 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm) | |
205 { | |
206 GdkPixmap *pm; | |
207 GdkBitmap *bm; | |
208 GtkWidget *pic; | |
209 GtkWidget *label; | |
210 | |
211 /*if the user had opted to put pictures on the buttons*/ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
212 if (display_options & OPT_DISP_SHOW_BUTTON_XPM && xpm) { |
1 | 213 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
214 NULL, xpm); | |
215 pic = gtk_pixmap_new(pm, bm); | |
216 gtk_widget_show(pic); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
217 gdk_pixmap_unref(pm); |
1 | 218 label = GTK_BIN(button)->child; |
219 gtk_container_remove(GTK_CONTAINER(button), label); | |
220 gtk_container_add(GTK_CONTAINER(button), pic); | |
221 } else { | |
222 label = gtk_label_new(c); | |
223 gtk_widget_show(label); | |
224 pic = GTK_BIN(button)->child; | |
225 gtk_container_remove(GTK_CONTAINER(button), pic); | |
226 gtk_container_add(GTK_CONTAINER(button), label); | |
227 } | |
228 | |
229 } | |
230 | |
231 | |
232 void update_button_pix() | |
233 { | |
234 | |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
235 if (display_options & OPT_DISP_DEVIL_PIXMAPS) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
236 adjust_pic(addbutton, _("Add"), (gchar **)daemon_buddyadd_xpm); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
237 adjust_pic(groupbutton, _("Group"), NULL); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
238 adjust_pic(rembutton, _("Remove"), (gchar **)daemon_buddydel_xpm); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
239 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
240 adjust_pic(chatbutton, _("Chat"), (gchar **)daemon_buddychat_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
241 adjust_pic(imbutton, _("IM"), (gchar **)daemon_im_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
242 adjust_pic(infobutton, _("Info"), (gchar **)daemon_info_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
243 } |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
244 /* adjust_pic(addpermbutton, _("Add"), (gchar **)daemon_permadd_xpm); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
245 adjust_pic(rempermbutton, _("Remove"), (gchar **)daemon_permdel_xpm); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
246 */ } else { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
247 adjust_pic(addbutton, _("Add"), (gchar **)buddyadd_xpm); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
248 adjust_pic(groupbutton, _("Group"), NULL); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
249 adjust_pic(rembutton, _("Remove"), (gchar **)buddydel_xpm); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
250 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
251 adjust_pic(chatbutton, _("Chat"), (gchar **)buddychat_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
252 adjust_pic(imbutton, _("IM"), (gchar **)im_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
253 adjust_pic(infobutton, _("Info"), (gchar **)info_xpm); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
254 } |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
255 /* adjust_pic(addpermbutton, _("Add"), (gchar **)permadd_xpm); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
256 adjust_pic(rempermbutton, _("Remove"), (gchar **)permdel_xpm); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
257 */ } |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
258 gtk_widget_hide(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
259 gtk_widget_show(addbutton->parent); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
260 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
261 gtk_widget_hide(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
262 gtk_widget_show(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
263 } |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
264 /* gtk_widget_hide(addpermbutton->parent); |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
265 gtk_widget_show(addpermbutton->parent); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
266 */} |
1 | 267 |
268 | |
269 | |
270 #ifdef USE_APPLET | |
271 gint applet_destroy_buddy( GtkWidget *widget, GdkEvent *event,gpointer *data ) { | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
272 applet_buddy_show = FALSE; |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
273 gtk_widget_hide(blist); |
1 | 274 return (TRUE); |
275 } | |
276 | |
277 #endif | |
278 | |
279 | |
280 void signoff() | |
281 { | |
282 GList *mem; | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
283 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
284 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
285 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
286 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
287 void (*function)(void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
288 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
289 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
290 if (g->event == event_signoff && g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
291 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
292 (*function)(g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
293 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
294 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
295 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
296 #endif |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
297 |
1 | 298 while(groups) { |
299 mem = ((struct group *)groups->data)->members; | |
300 while(mem) { | |
301 g_free(mem->data); | |
302 mem = g_list_remove(mem, mem->data); | |
303 } | |
304 g_free(groups->data); | |
305 groups = g_list_remove(groups, groups->data); | |
306 } | |
307 | |
308 serv_close(); | |
309 destroy_all_dialogs(); | |
310 destroy_buddy(); | |
311 hide_login_progress(""); | |
312 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
313 set_user_state(offline); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
314 applet_buddy_show = FALSE; |
1 | 315 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); |
18 | 316 remove_applet_away(); |
1 | 317 applet_widget_register_callback(APPLET_WIDGET(applet), |
318 "signon", | |
319 _("Signon"), | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
320 applet_do_signon, |
1 | 321 NULL); |
322 #else | |
323 show_login(); | |
324 #endif /* USE_APPLET */ | |
436 | 325 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
326 BuddyTickerSignoff(); | |
1 | 327 } |
328 | |
329 void handle_click_group(GtkWidget *widget, GdkEventButton *event, gpointer func_data) | |
330 { | |
331 if (event->type == GDK_2BUTTON_PRESS) { | |
332 if (GTK_TREE_ITEM(widget)->expanded) | |
333 gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); | |
334 else | |
335 gtk_tree_item_expand(GTK_TREE_ITEM(widget)); | |
336 } else { | |
337 } | |
338 } | |
339 | |
340 void pressed_im(GtkWidget *widget, struct buddy *b) | |
341 { | |
342 struct conversation *c; | |
343 | |
344 c = find_conversation(b->name); | |
345 | |
346 if (c != NULL) { | |
87 | 347 gdk_window_show(c->window->window); |
1 | 348 } else { |
349 c = new_conversation(b->name); | |
350 } | |
351 } | |
352 | |
438 | 353 void pressed_ticker(char *buddy) |
354 { | |
355 struct conversation *c; | |
356 | |
357 c = find_conversation(buddy); | |
358 | |
359 if (c != NULL) { | |
360 gdk_window_show(c->window->window); | |
361 } else { | |
362 c = new_conversation(buddy); | |
363 } | |
364 } | |
365 | |
1 | 366 void pressed_info(GtkWidget *widget, struct buddy *b) |
367 { | |
368 serv_get_info(b->name); | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
369 } |
1 | 370 |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
371 void pressed_alias(GtkWidget *widget, struct buddy *b) |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
372 { |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
373 alias_dialog(b); |
1 | 374 } |
375 | |
376 void pressed_dir_info(GtkWidget *widget, struct buddy *b) | |
377 { | |
378 serv_get_dir(b->name); | |
379 | |
380 } | |
381 | |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
382 void pressed_away_msg(GtkWidget *widget, struct buddy *b) |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
383 { |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
384 serv_get_away_msg(b->name); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
385 |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
386 } |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
387 |
1 | 388 void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy *b) |
389 { | |
390 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
391 struct conversation *c; | |
392 | |
393 c = find_conversation(b->name); | |
394 | |
395 if (c != NULL) { | |
87 | 396 gdk_window_show(c->window->window); |
1 | 397 } else { |
398 c = new_conversation(b->name); | |
399 } | |
400 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { | |
401 GtkWidget *menu, *button; | |
402 /* We're gonna make us a menu right here */ | |
403 | |
404 menu = gtk_menu_new(); | |
405 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
406 button = gtk_menu_item_new_with_label(_("IM")); |
1 | 407 gtk_signal_connect(GTK_OBJECT(button), "activate", |
408 GTK_SIGNAL_FUNC(pressed_im), b); | |
409 gtk_menu_append(GTK_MENU(menu), button); | |
410 gtk_widget_show(button); | |
411 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
412 button = gtk_menu_item_new_with_label(_("Info")); |
1 | 413 gtk_signal_connect(GTK_OBJECT(button), "activate", |
414 GTK_SIGNAL_FUNC(pressed_info), b); | |
415 gtk_menu_append(GTK_MENU(menu), button); | |
416 gtk_widget_show(button); | |
417 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
418 button = gtk_menu_item_new_with_label(_("Alias")); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
419 gtk_signal_connect(GTK_OBJECT(button), "activate", |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
420 GTK_SIGNAL_FUNC(pressed_alias), b); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
421 gtk_menu_append(GTK_MENU(menu), button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
422 gtk_widget_show(button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
423 |
760
d2eef8a40a77
[gaim-migrate @ 770]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
424 if (!USE_OSCAR) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
425 button = gtk_menu_item_new_with_label(_("Dir Info")); |
1 | 426 gtk_signal_connect(GTK_OBJECT(button), "activate", |
427 GTK_SIGNAL_FUNC(pressed_dir_info), b); | |
428 gtk_menu_append(GTK_MENU(menu), button); | |
429 gtk_widget_show(button); | |
760
d2eef8a40a77
[gaim-migrate @ 770]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
430 } else { |
1 | 431 |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
432 button = gtk_menu_item_new_with_label(_("Direct IM")); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
433 gtk_signal_connect(GTK_OBJECT(button), "activate", |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
434 GTK_SIGNAL_FUNC(serv_do_imimage), b->name); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
435 gtk_menu_append(GTK_MENU(menu), button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
436 gtk_widget_show(button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
437 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
438 button = gtk_menu_item_new_with_label(_("Away Msg")); |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
439 gtk_signal_connect(GTK_OBJECT(button), "activate", |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
440 GTK_SIGNAL_FUNC(pressed_away_msg), b); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
441 gtk_menu_append(GTK_MENU(menu), button); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
442 gtk_widget_show(button); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
443 } |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
444 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
445 button = gtk_menu_item_new_with_label(_("Toggle Logging")); |
1 | 446 gtk_signal_connect(GTK_OBJECT(button), "activate", |
447 GTK_SIGNAL_FUNC(log_callback), b->name); | |
448 gtk_menu_append(GTK_MENU(menu), button); | |
449 gtk_widget_show(button); | |
450 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
451 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
1 | 452 gtk_signal_connect(GTK_OBJECT(button), "activate", |
453 GTK_SIGNAL_FUNC(new_bp_callback), b->name); | |
454 gtk_menu_append(GTK_MENU(menu), button); | |
455 gtk_widget_show(button); | |
456 | |
457 | |
458 | |
459 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, | |
460 event->button, event->time); | |
461 | |
462 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { | |
463 if (!strcasecmp("zilding", normalize(b->name))) | |
464 show_ee_dialog(0); | |
465 else if (!strcasecmp("robflynn", normalize(b->name))) | |
466 show_ee_dialog(1); | |
467 else if (!strcasecmp("flynorange", normalize(b->name))) | |
468 show_ee_dialog(2); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
469 else if (!strcasecmp("ewarmenhoven", normalize(b->name))) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
470 show_ee_dialog(3); |
1 | 471 |
472 } else { | |
473 | |
474 /* Anything for other buttons? :) */ | |
475 } | |
476 } | |
477 | |
478 | |
479 | |
480 void remove_buddy(struct group *rem_g, struct buddy *rem_b) | |
481 { | |
482 GList *grp; | |
483 GList *mem; | |
484 | |
485 struct group *delg; | |
486 struct buddy *delb; | |
487 | |
488 grp = g_list_find(groups, rem_g); | |
489 delg = (struct group *)grp->data; | |
490 mem = delg->members; | |
491 | |
492 mem = g_list_find(mem, rem_b); | |
493 delb = (struct buddy *)mem->data; | |
494 | |
495 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
496 delg->members = g_list_remove(delg->members, delb); | |
497 serv_remove_buddy(delb->name); | |
498 g_free(delb); | |
499 | |
500 serv_save_config(); | |
228 | 501 |
502 // flush buddy list to cache | |
503 | |
504 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 505 |
506 update_num_groups(); | |
507 | |
508 | |
509 } | |
510 | |
511 void remove_group(struct group *rem_g) | |
512 { | |
513 GList *grp; | |
514 GList *mem; | |
515 | |
516 struct group *delg; | |
517 struct buddy *delb; | |
518 | |
519 grp = g_list_find(groups, rem_g); | |
520 delg = (struct group *)grp->data; | |
521 mem = delg->members; | |
522 | |
523 while(delg->members) { | |
524 delb = (struct buddy *)delg->members->data; | |
525 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
526 delg->members = g_list_remove(delg->members, delb); | |
527 serv_remove_buddy(delb->name); | |
528 g_free(delb); | |
529 } | |
530 | |
531 | |
532 gtk_tree_remove_items(GTK_TREE(buddies), g_list_append(NULL, delg->item)); | |
533 groups = g_list_remove(groups, delg); | |
534 g_free(delg); | |
535 | |
536 serv_save_config(); | |
228 | 537 |
538 // flush buddy list to cache | |
539 | |
540 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 541 } |
542 | |
543 | |
544 | |
545 | |
546 | |
547 gboolean edit_drag_compare_func (GtkCTree *ctree, GtkCTreeNode *source_node, | |
548 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling) | |
549 { | |
550 gboolean leaf; | |
551 | |
552 gtk_ctree_get_node_info (ctree, source_node, NULL, | |
553 NULL, NULL, NULL, NULL, NULL, &leaf, NULL); | |
554 | |
555 | |
556 if (leaf) { | |
557 if (!new_parent) | |
558 return FALSE; | |
559 } else { | |
560 | |
561 if (new_parent) | |
562 return FALSE; | |
563 | |
564 } | |
565 | |
566 return TRUE; | |
567 } | |
568 | |
569 | |
570 | |
571 static void edit_tree_move (GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent, | |
572 GtkCTreeNode *sibling, gpointer data) | |
573 { | |
574 char *source; | |
575 char *target1; | |
576 char *target2; | |
577 | |
578 gtk_ctree_get_node_info (ctree, child, &source, | |
579 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
580 if (parent) | |
581 gtk_ctree_get_node_info (ctree, parent, &target1, | |
582 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
583 if (sibling) | |
584 gtk_ctree_get_node_info (ctree, sibling, &target2, | |
585 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
586 | |
587 | |
588 if (!parent) { | |
589 GList *grps, *buds; | |
590 struct group *g, *g2; | |
591 GList *tmp; | |
592 int pos; | |
593 struct buddy *b; | |
594 /* Okay we've moved group order... */ | |
595 | |
596 g = find_group(source); | |
597 | |
598 gtk_widget_ref(g->tree); | |
599 | |
600 buds = g->members; | |
601 while(buds) { | |
602 b = (struct buddy *)buds->data; | |
603 gtk_widget_ref(b->item); | |
604 gtk_widget_ref(b->label); | |
605 gtk_widget_ref(b->idletime); | |
606 gtk_widget_ref(b->pix); | |
607 buds = buds->next; | |
608 } | |
609 | |
610 | |
611 | |
612 | |
613 pos = g_list_index(GTK_TREE(buddies)->children, g->item); | |
614 | |
615 tmp = g_list_append(NULL, g->item); | |
616 gtk_tree_remove_items(GTK_TREE(buddies), tmp); | |
617 g_list_free(tmp); | |
618 | |
619 groups = g_list_remove(groups, g); | |
620 | |
621 g->item = gtk_tree_item_new_with_label(g->name); | |
622 gtk_widget_show(g->item); | |
623 | |
624 if (sibling) { | |
625 g2 = find_group(target2); | |
626 pos = g_list_index(groups, g2); | |
627 if (pos == 0) { | |
628 groups = g_list_prepend(groups, g); | |
629 gtk_tree_prepend(GTK_TREE(buddies), g->item); | |
630 } else { | |
631 groups = g_list_insert(groups, g, pos); | |
632 gtk_tree_insert(GTK_TREE(buddies), g->item, pos); | |
633 } | |
634 | |
635 } else { | |
636 groups = g_list_append(groups, g); | |
637 gtk_tree_append(GTK_TREE(buddies), g->item); | |
638 | |
639 } | |
640 | |
641 gtk_tree_item_set_subtree (GTK_TREE_ITEM(g->item), g->tree); | |
642 gtk_tree_item_expand (GTK_TREE_ITEM(g->item)); | |
643 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
644 GTK_SIGNAL_FUNC(handle_click_group), | |
645 NULL); | |
646 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
647 | |
648 gtk_widget_unref(g->tree); | |
649 | |
650 update_num_groups(); | |
651 | |
652 | |
653 buds = g->members; | |
654 | |
655 while(buds) { | |
656 b = (struct buddy *)buds->data; | |
657 set_buddy(b); | |
658 buds = buds->next; | |
659 } | |
660 | |
661 grps = groups; | |
662 while(grps) { | |
663 g = (struct group *)grps->data; | |
664 grps = grps->next; | |
665 } | |
666 | |
667 } else { | |
668 struct group *new_g, *old_g; | |
669 struct buddy *b, *s; | |
670 GtkWidget *gtree; | |
671 GtkWidget *owner; | |
672 GList *temp; | |
673 int pos; | |
674 | |
675 b = find_buddy(source); | |
676 new_g = find_group(target1); | |
677 old_g = find_group_by_buddy(source); | |
678 gtree = old_g->tree; | |
679 if (sibling) | |
680 s = find_buddy(target2); | |
681 else | |
682 s = NULL; | |
683 | |
684 old_g->members = g_list_remove(old_g->members, b); | |
685 | |
686 gtk_widget_ref(b->item); | |
687 gtk_widget_ref(b->label); | |
688 gtk_widget_ref(b->pix); | |
689 gtk_widget_ref(b->idletime); | |
690 gtk_widget_ref(gtree); | |
691 | |
692 owner = GTK_TREE(gtree)->tree_owner; | |
693 | |
694 temp = g_list_append(NULL, b->item); | |
695 gtk_tree_remove_items(GTK_TREE(old_g->tree), temp); | |
696 g_list_free(temp); | |
697 | |
698 if (gtree->parent == NULL){ | |
699 gtk_tree_item_set_subtree (GTK_TREE_ITEM(owner), gtree); | |
700 gtk_tree_item_expand (GTK_TREE_ITEM(owner)); | |
701 } | |
702 | |
703 if (!sibling) { | |
704 gtk_tree_append(GTK_TREE(new_g->tree), b->item); | |
705 new_g->members = g_list_append(new_g->members, b); | |
706 } else { | |
707 pos = g_list_index(new_g->members, s); | |
708 if (pos != 0) { | |
709 new_g->members = g_list_insert(new_g->members, b, pos); | |
710 gtk_tree_insert(GTK_TREE(new_g->tree), b->item, pos); | |
711 } else { | |
712 new_g->members = g_list_prepend(new_g->members, b); | |
713 gtk_tree_prepend(GTK_TREE(new_g->tree), b->item); | |
714 | |
715 } | |
716 } | |
717 | |
718 gtk_widget_unref(b->item); | |
719 gtk_widget_unref(b->label); | |
720 gtk_widget_unref(b->pix); | |
721 gtk_widget_unref(b->idletime); | |
722 gtk_widget_unref(gtree); | |
723 | |
724 gtk_ctree_expand(ctree, parent); | |
725 | |
726 update_num_groups(); | |
727 update_show_idlepix(); | |
728 set_buddy(b); | |
729 | |
730 | |
731 | |
732 | |
733 | |
734 } | |
735 | |
736 serv_save_config(); | |
228 | 737 |
738 // flush buddy list to cache | |
739 | |
740 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 741 } |
742 | |
743 | |
744 | |
745 void build_edit_tree() | |
746 { | |
747 GtkCTreeNode *p = NULL, *n; | |
748 GList *grp = groups; | |
749 GList *mem; | |
750 struct group *g; | |
751 struct buddy *b; | |
752 char *text[1]; | |
753 | |
754 gtk_clist_freeze(GTK_CLIST(edittree)); | |
755 gtk_clist_clear(GTK_CLIST(edittree)); | |
756 | |
757 | |
758 while(grp) { | |
759 g = (struct group *)grp->data; | |
760 | |
761 text[0] = g->name; | |
762 | |
763 p = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, | |
764 NULL, text, 5, NULL, NULL, | |
765 NULL, NULL, 0, 1); | |
766 | |
767 n = NULL; | |
768 | |
769 mem = g->members; | |
770 | |
771 while(mem) { | |
772 b = (struct buddy *)mem->data; | |
773 | |
774 text[0] = b->name; | |
775 | |
776 n = gtk_ctree_insert_node(GTK_CTREE(edittree), | |
777 p, NULL, text, 5, | |
778 NULL, NULL, | |
779 NULL, NULL, 1, 1); | |
780 | |
781 mem = mem->next; | |
782 | |
783 } | |
784 grp = grp->next; | |
785 } | |
786 | |
787 gtk_clist_thaw(GTK_CLIST(edittree)); | |
788 | |
789 } | |
790 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
791 struct buddy *add_buddy(char *group, char *buddy, char *show) |
1 | 792 { |
793 struct buddy *b; | |
794 struct group *g; | |
795 GdkPixmap *pm; | |
796 GdkBitmap *bm; | |
797 GtkWidget *box; | |
798 | |
799 | |
800 if ((b = find_buddy(buddy)) != NULL) | |
801 return b; | |
802 | |
803 g = find_group(group); | |
804 | |
805 if (g == NULL) | |
806 g = add_group(group); | |
807 | |
808 b = (struct buddy *)g_new0(struct buddy, 1); | |
809 | |
810 if (!b) | |
811 return NULL; | |
812 | |
813 b->present = 0; | |
814 b->item = gtk_tree_item_new(); | |
815 | |
816 g_snprintf(b->name, sizeof(b->name), "%s", buddy); | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
817 g_snprintf(b->show, sizeof(b->show), "%s", show ? (show[0] ? show : buddy) : buddy); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
818 |
1 | 819 g->members = g_list_append(g->members, b); |
820 | |
821 | |
822 if (blist == NULL) | |
823 return b; | |
824 | |
825 box = gtk_hbox_new(FALSE, 1); | |
826 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
827 NULL, (gchar **)login_icon_xpm); | |
828 b->pix = gtk_pixmap_new(pm, bm); | |
829 | |
830 b->idle = 0; | |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
831 b->caps = 0; |
1 | 832 |
833 gtk_widget_show(b->pix); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
834 gdk_pixmap_unref(pm); |
1 | 835 |
836 b->label = gtk_label_new(buddy); | |
837 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); | |
838 | |
839 b->idletime = gtk_label_new(""); | |
840 | |
841 gtk_tree_append(GTK_TREE(g->tree),b->item); | |
842 gtk_container_add(GTK_CONTAINER(b->item), box); | |
843 | |
844 gtk_box_pack_start(GTK_BOX(box), b->pix, FALSE, FALSE, 1); | |
845 gtk_box_pack_start(GTK_BOX(box), b->label, TRUE, TRUE, 1); | |
846 gtk_box_pack_start(GTK_BOX(box), b->idletime, FALSE, FALSE, 1); | |
847 | |
848 gtk_widget_show(b->label); | |
849 gtk_widget_show(box); | |
850 | |
851 gtk_object_set_user_data(GTK_OBJECT(b->item), b); | |
852 | |
853 gtk_signal_connect(GTK_OBJECT(b->item), "button_press_event", | |
854 GTK_SIGNAL_FUNC(handle_click_buddy), b); | |
430 | 855 |
1 | 856 return b; |
857 } | |
858 | |
859 | |
860 struct group *add_group(char *group) | |
861 { | |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
862 struct group *g = find_group(group); |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
863 if (g) |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
864 return g; |
1 | 865 g = (struct group *)g_new0(struct group, 1); |
866 if (!g) | |
867 return NULL; | |
868 | |
869 strncpy(g->name, group, sizeof(g->name)); | |
870 groups = g_list_append(groups, g); | |
871 | |
872 if (blist == NULL) | |
873 return g; | |
874 | |
875 g->item = gtk_tree_item_new(); | |
876 g->label = gtk_label_new(g->name); | |
877 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5); | |
878 gtk_widget_show(g->label); | |
879 gtk_container_add(GTK_CONTAINER(g->item), g->label); | |
880 g->tree = gtk_tree_new(); | |
881 gtk_widget_show(g->item); | |
882 gtk_widget_show(g->tree); | |
883 gtk_tree_append(GTK_TREE(buddies), g->item); | |
884 gtk_tree_item_set_subtree(GTK_TREE_ITEM(g->item), g->tree); | |
885 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); | |
886 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
887 GTK_SIGNAL_FUNC(handle_click_group), | |
888 NULL); | |
889 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
890 g->members = NULL; | |
891 | |
892 | |
893 build_edit_tree(); | |
894 | |
895 return g; | |
896 | |
897 } | |
898 | |
899 | |
900 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree) | |
901 { | |
902 GtkCTreeNode *node; | |
903 char *bud, *grp; | |
904 struct buddy *b; | |
905 struct group *g; | |
906 GList *i; | |
907 | |
908 i = GTK_CLIST(edittree)->selection; | |
909 if (i) { | |
910 node = i->data; | |
911 | |
912 if (GTK_CTREE_ROW(node)->is_leaf) { | |
913 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &bud, | |
914 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
915 | |
916 b = find_buddy(bud); | |
917 g = find_group_by_buddy(bud); | |
918 remove_buddy(g, b); | |
919 } else { | |
920 gtk_ctree_get_node_info (ctree, node, &grp, | |
921 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
922 g = find_group(grp); | |
923 remove_group(g); | |
924 } | |
925 | |
926 build_edit_tree(); | |
927 serv_save_config(); | |
228 | 928 |
929 // flush buddy list to cache | |
930 | |
931 do_export( (GtkWidget *) NULL, 0 ); | |
932 | |
1 | 933 } else { |
934 /* Nothing selected. */ | |
935 } | |
936 update_num_groups(); | |
937 } | |
938 | |
939 | |
940 void gaimreg_callback(GtkWidget *widget) | |
941 { | |
942 show_register_dialog(); | |
943 } | |
944 | |
945 void import_callback(GtkWidget *widget, void *null) | |
946 { | |
947 show_import_dialog(); | |
948 } | |
949 | |
950 void export_callback(GtkWidget *widget, void *null) | |
951 { | |
952 show_export_dialog(); | |
953 } | |
954 | |
955 | |
956 | |
957 void do_quit() | |
958 { | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
959 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
960 GList *c; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
961 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
962 struct gaim_plugin *p; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
963 void (*function)(void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
964 void (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
965 char *error; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
966 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
967 /* first we tell those who have requested it we're quitting */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
968 c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
969 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
970 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
971 if (g->event == event_quit && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
972 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
973 (*function)(g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
974 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
975 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
976 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
977 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
978 /* then we remove everyone in a mass suicide */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
979 c = plugins; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
980 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
981 p = (struct gaim_plugin *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
982 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
983 if ((error = (char *)dlerror()) == NULL) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
984 (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
985 /* we don't need to worry about removing callbacks since |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
986 * there won't be any more chance to call them back :) */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
987 dlclose(p->handle); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
988 g_free(p->filename); /* why do i bother? */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
989 g_free(p); |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
990 c = c->next; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
991 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
992 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
993 |
1 | 994 exit(0); |
995 } | |
996 | |
997 void add_buddy_callback(GtkWidget *widget, void *dummy) | |
998 { | |
999 char *grp = NULL; | |
1000 GtkCTreeNode *node; | |
1001 GList *i; | |
1002 | |
1003 i = GTK_CLIST(edittree)->selection; | |
1004 if (i) { | |
1005 node = i->data; | |
1006 | |
1007 if (GTK_CTREE_ROW(node)->is_leaf) { | |
1008 node = GTK_CTREE_ROW(node)->parent; | |
1009 } | |
1010 | |
1011 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &grp, | |
1012 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1013 } | |
1014 show_add_buddy(NULL, grp); | |
1015 | |
1016 } | |
1017 | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1018 void add_group_callback(GtkWidget *widget, void *dummy) |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1019 { |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1020 show_add_group(); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1021 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1022 |
1 | 1023 static void info_callback(GtkWidget *widget, GtkTree *tree) |
1024 { | |
1025 GList *i; | |
1026 struct buddy *b = NULL; | |
1027 i = GTK_TREE_SELECTION(tree); | |
1028 if (i) { | |
1029 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
1030 } else { | |
1031 return; | |
1032 } | |
1033 if (!b->name) | |
1034 return; | |
1035 serv_get_info(b->name); | |
1036 } | |
1037 | |
1038 | |
1039 void chat_callback(GtkWidget *widget, GtkTree *tree) | |
1040 { | |
1041 join_chat(); | |
1042 } | |
1043 | |
1044 struct group *find_group(char *group) | |
1045 { | |
1046 struct group *g; | |
1047 GList *grp = groups; | |
1048 char *grpname = g_malloc(strlen(group) + 1); | |
1049 | |
1050 strcpy(grpname, normalize(group)); | |
1051 while (grp) { | |
1052 g = (struct group *)grp->data; | |
1053 if (!strcasecmp(normalize(g->name), grpname)) { | |
1054 g_free(grpname); | |
1055 return g; | |
1056 } | |
1057 grp = grp->next; | |
1058 } | |
1059 | |
1060 g_free(grpname); | |
1061 return NULL; | |
1062 | |
1063 } | |
1064 | |
1065 | |
1066 struct group *find_group_by_buddy(char *who) | |
1067 { | |
1068 struct group *g; | |
1069 struct buddy *b; | |
1070 GList *grp = groups; | |
1071 GList *mem; | |
1072 char *whoname = g_malloc(strlen(who) + 1); | |
1073 | |
1074 strcpy(whoname, normalize(who)); | |
1075 | |
1076 while(grp) { | |
1077 g = (struct group *)grp->data; | |
1078 | |
1079 mem = g->members; | |
1080 while(mem) { | |
1081 b = (struct buddy *)mem->data; | |
1082 if (!strcasecmp(normalize(b->name), whoname)) { | |
1083 g_free(whoname); | |
1084 return g; | |
1085 } | |
1086 mem = mem->next; | |
1087 } | |
1088 grp = grp->next; | |
1089 } | |
1090 g_free(whoname); | |
1091 return NULL; | |
1092 } | |
1093 | |
1094 | |
1095 struct buddy *find_buddy(char *who) | |
1096 { | |
1097 struct group *g; | |
1098 struct buddy *b; | |
1099 GList *grp = groups; | |
1100 GList *mem; | |
1101 char *whoname = g_malloc(strlen(who) + 1); | |
1102 | |
1103 strcpy(whoname, normalize(who)); | |
1104 | |
1105 while(grp) { | |
1106 g = (struct group *)grp->data; | |
1107 | |
1108 mem = g->members; | |
1109 while(mem) { | |
1110 b = (struct buddy *)mem->data; | |
1111 if (!strcasecmp(normalize(b->name), whoname)) { | |
1112 g_free(whoname); | |
1113 return b; | |
1114 } | |
1115 mem = mem->next; | |
1116 } | |
1117 grp = grp->next; | |
1118 } | |
1119 g_free(whoname); | |
1120 return NULL; | |
1121 } | |
1122 | |
1123 | |
1124 void rem_bp(GtkWidget *w, struct buddy_pounce *b) | |
1125 { | |
1126 buddy_pounces = g_list_remove(buddy_pounces, b); | |
689
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1127 do_bp_menu(); |
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1128 save_prefs(); |
1 | 1129 } |
1130 | |
1131 void do_pounce(char *name) | |
1132 { | |
26 | 1133 char *who; |
1 | 1134 |
1135 struct buddy_pounce *b; | |
1136 struct conversation *c; | |
1137 | |
1138 GList *bp = buddy_pounces; | |
1139 | |
26 | 1140 who = g_strdup(normalize(name)); |
1 | 1141 |
1142 while(bp) { | |
1143 b = (struct buddy_pounce *)bp->data;; | |
26 | 1144 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ |
1145 | |
1 | 1146 if (!strcasecmp(who, normalize(b->name))) { |
1147 if (b->popup == 1) | |
1148 { | |
1149 c = find_conversation(name); | |
1150 if (c == NULL) | |
1151 c = new_conversation(name); | |
1152 } | |
1153 if (b->sendim == 1) | |
1154 { | |
1155 c = find_conversation(name); | |
1156 if (c == NULL) | |
1157 c = new_conversation(name); | |
1158 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1159 write_to_conv(c, b->message, WFLAG_SEND, NULL); |
1 | 1160 |
1161 escape_text(b->message); | |
1162 | |
1163 serv_send_im(name, b->message, 0); | |
1164 } | |
1165 | |
1166 rem_bp(NULL, b); | |
1167 | |
1168 } | |
1169 } | |
1170 g_free(who); | |
1171 } | |
1172 | |
1173 static void new_bp_callback(GtkWidget *w, char *name) | |
1174 { | |
1175 show_new_bp(name); | |
1176 } | |
1177 | |
1178 static void log_callback(GtkWidget *w, char *name) | |
1179 { | |
1180 struct conversation *c = find_conversation(name); | |
1181 | |
1182 if (find_log_info(name)) | |
1183 { | |
1184 if (c) { | |
1185 set_state_lock(1); | |
1186 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), FALSE); | |
1187 set_state_lock(0); | |
1188 } | |
1189 rm_log(find_log_info(name)); | |
1190 } | |
1191 else | |
1192 { | |
1193 if (c) { | |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
1194 show_log_dialog(c); |
1 | 1195 set_state_lock(1); |
1196 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), TRUE); | |
1197 set_state_lock(0); | |
1198 } | |
1199 } | |
1200 } | |
1201 | |
1202 void do_bp_menu() | |
1203 { | |
1204 GtkWidget *menuitem, *mess, *messmenu; | |
1205 static GtkWidget *remmenu; | |
1206 GtkWidget *remitem; | |
1207 GtkWidget *sep; | |
1208 GList *l; | |
1209 struct buddy_pounce *b; | |
1210 GList *bp = buddy_pounces; | |
1211 | |
1212 l = gtk_container_children(GTK_CONTAINER(bpmenu)); | |
1213 | |
1214 while(l) { | |
1215 gtk_widget_destroy(GTK_WIDGET(l->data)); | |
1216 l = l->next; | |
1217 } | |
1218 | |
1219 remmenu = gtk_menu_new(); | |
1220 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1221 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce")); |
1 | 1222 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1223 gtk_widget_show(menuitem); | |
1224 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(new_bp_callback), NULL); | |
1225 | |
1226 | |
1227 while(bp) { | |
1228 | |
1229 b = (struct buddy_pounce *)bp->data; | |
1230 remitem = gtk_menu_item_new_with_label(b->name); | |
1231 gtk_menu_append(GTK_MENU(remmenu), remitem); | |
1232 gtk_widget_show(remitem); | |
1233 gtk_signal_connect(GTK_OBJECT(remitem), "activate", GTK_SIGNAL_FUNC(rem_bp), b); | |
1234 | |
1235 bp = bp->next; | |
1236 | |
1237 } | |
1238 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1239 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); |
1 | 1240 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1241 gtk_widget_show(menuitem); | |
1242 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); | |
1243 gtk_widget_show(remmenu); | |
1244 | |
1245 | |
1246 sep = gtk_hseparator_new(); | |
1247 menuitem = gtk_menu_item_new(); | |
1248 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1249 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1250 gtk_widget_set_sensitive(menuitem, FALSE); | |
1251 gtk_widget_show(menuitem); | |
1252 gtk_widget_show(sep); | |
1253 | |
1254 bp = buddy_pounces;; | |
1255 | |
1256 while(bp) { | |
1257 | |
1258 b = (struct buddy_pounce *)bp->data; | |
1259 | |
1260 menuitem = gtk_menu_item_new_with_label(b->name); | |
1261 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1262 messmenu = gtk_menu_new(); | |
1263 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); | |
1264 gtk_widget_show(menuitem); | |
1265 | |
1266 | |
1267 | |
1268 mess = gtk_menu_item_new_with_label(b->message); | |
1269 gtk_menu_append(GTK_MENU(messmenu), mess); | |
1270 gtk_widget_show(mess); | |
1271 | |
1272 bp = bp->next; | |
1273 | |
1274 } | |
1275 | |
1276 } | |
1277 | |
1278 | |
1279 gint log_timeout(char *name) | |
1280 { | |
1281 struct buddy *b; | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1282 struct group *g; |
1 | 1283 |
1284 b = find_buddy(name); | |
1285 | |
1286 if(!b) | |
1287 return FALSE; | |
1288 | |
1289 b->log_timer = 0; | |
1290 | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1291 if (!b->present) { |
1 | 1292 gtk_widget_hide(b->item); |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1293 g = find_group_by_buddy(name); |
120
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1294 if (GTK_TREE_ITEM(g->item)->expanded) { |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1295 gtk_tree_item_collapse(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1296 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1297 } |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1298 } else |
1 | 1299 set_buddy(b); |
1300 | |
1301 return FALSE; | |
1302 } | |
1303 | |
1304 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1305 static char *caps_string(u_short caps) |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1306 { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1307 static char buf[BUF_LEN]; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1308 int count = 0, i = 0; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1309 u_short bit = 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1310 while (bit <= AIM_CAPS_SENDFILE) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1311 if (bit & caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1312 switch (bit) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1313 case AIM_CAPS_BUDDYICON: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1314 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sBuddy Icon"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1315 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1316 case AIM_CAPS_VOICE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1317 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sVoice"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1318 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1319 case AIM_CAPS_IMIMAGE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1320 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sIM Image"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1321 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1322 case AIM_CAPS_CHAT: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1323 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sChat"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1324 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1325 case AIM_CAPS_GETFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1326 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sGet File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1327 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1328 case AIM_CAPS_SENDFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1329 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sSend File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1330 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1331 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1332 count++; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1333 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1334 bit <<= 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1335 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1336 return buf; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1337 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1338 |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1339 |
1 | 1340 void set_buddy(struct buddy *b) |
1341 { | |
1342 char infotip[256]; | |
1343 char idlet[16]; | |
1344 char warn[256]; | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1345 char caps[256]; |
70 | 1346 char *who; |
1 | 1347 int i; |
1348 int ihrs, imin; | |
1349 time_t t; | |
1350 GdkPixmap *pm; | |
1351 GdkBitmap *bm; | |
1352 char *itime, *sotime; | |
1353 | |
1354 if (b->present) { | |
1355 time(&t); | |
1356 | |
1357 ihrs = (t - b->idle) / 3600; | |
1358 imin = ((t - b->idle) / 60) % 60; | |
1359 | |
1360 if (ihrs) | |
1361 g_snprintf(idlet, sizeof(idlet), "(%d:%02d)", ihrs, imin); | |
1362 else | |
1363 g_snprintf(idlet, sizeof(idlet), "(%02d)", imin); | |
1364 | |
1365 gtk_widget_hide(b->idletime); | |
1366 | |
1367 if (b->idle) | |
1368 gtk_label_set(GTK_LABEL(b->idletime), idlet); | |
1369 else | |
1370 gtk_label_set(GTK_LABEL(b->idletime), ""); | |
1371 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
1372 gtk_widget_show(b->idletime); | |
1373 | |
1374 | |
1375 sotime = sec_to_text(t - b->signon + correction_time); | |
1376 if (b->idle) { | |
1377 itime = sec_to_text(t - b->idle); | |
1378 } else { | |
1379 itime = g_malloc(1); | |
1380 itime[0] = 0; | |
1381 } | |
1382 | |
1383 if (b->evil) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1384 g_snprintf(warn, sizeof(warn), _("Warnings: %d%%\n"), b->evil); |
1 | 1385 |
1386 } else | |
1387 warn[0] = '\0'; | |
1388 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1389 if (b->caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1390 g_snprintf(caps, sizeof(caps), _("Capabilities: %s\n"), caps_string(b->caps)); |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1391 } else |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1392 caps[0] = '\0'; |
1 | 1393 |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1394 i = g_snprintf(infotip, sizeof(infotip), _("Name: %s \nLogged in: %s\n%s%s%s%s%s"), b->show, sotime, warn, ((b->idle) ? _("Idle: ") : ""), itime, ((b->idle) ? "\n" : ""), caps); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1395 |
1 | 1396 gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, ""); |
1397 | |
1398 g_free(sotime); | |
1399 g_free(itime); | |
1400 | |
1401 | |
1402 | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1403 /* this check should also depend on whether they left, |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1404 * and signed on again before they got erased */ |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1405 if (!GTK_WIDGET_VISIBLE(b->item) || b->present == 1) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1406 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1407 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1408 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1409 void (*function)(char *, void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1410 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1411 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1412 if (g->event == event_buddy_signon && |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1413 g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1414 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1415 (*function)(b->name, g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1416 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1417 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1418 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1419 #endif |
1 | 1420 |
1421 play_sound(BUDDY_ARRIVE); | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1422 b->present = 2; |
1 | 1423 |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1424 who = g_malloc(sizeof(b->show) + 10); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1425 strcpy(who, b->show); |
70 | 1426 gtk_label_set(GTK_LABEL(b->label), who); |
1427 g_free(who); | |
1428 | |
1 | 1429 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1430 NULL, (gchar **)login_icon_xpm); | |
1431 gtk_widget_hide(b->pix); | |
1432 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
1433 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1434 gtk_widget_show(b->pix); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1435 gdk_pixmap_unref(pm); |
1 | 1436 |
430 | 1437 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1438 NULL, (gchar **)login_icon_xpm); | |
1439 | |
436 | 1440 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1441 BuddyTickerAddUser( b->name, pm, bm ); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1442 gdk_pixmap_unref(pm); |
430 | 1443 |
1 | 1444 if (display_options & OPT_DISP_SHOW_LOGON) { |
1445 struct conversation *c = find_conversation(b->name); | |
1446 if (c) { | |
1447 char tmp[1024]; | |
1448 | |
1449 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1450 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged in%s%s.</B><BR><HR>"), b->name, |
1 | 1451 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1452 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1453 | |
1454 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1455 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1456 |
1457 } | |
1458 } | |
1459 | |
1460 | |
1461 gtk_widget_show(b->item); | |
1462 gtk_widget_show(b->label); | |
58 | 1463 b->log_timer = gtk_timeout_add(10000, (GtkFunction) log_timeout, b->name); |
436 | 1464 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1465 gtk_timeout_add(10000, (GtkFunction) BuddyTickerLogonTimeout, b->name); | |
1 | 1466 update_num_groups(); |
1467 update_show_idlepix(); | |
1468 setup_buddy_chats(); | |
1469 return; | |
1470 } | |
1471 | |
1472 | |
1473 | |
1474 if (!b->log_timer) { | |
1475 gtk_widget_hide(b->pix); | |
1476 if (b->uc & UC_UNAVAILABLE) { | |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1477 #ifdef GAIM_PLUGINS |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1478 GList *c = callbacks; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1479 struct gaim_callback *g; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1480 void (*function)(char *, void *); |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1481 while (c) { |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1482 g = (struct gaim_callback *)c->data; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1483 if (g->event == event_buddy_away && |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1484 g->function != NULL) { |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1485 function = g->function; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1486 (*function)(b->name, g->data); |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1487 } |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1488 c = c->next; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1489 } |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1490 #endif |
1 | 1491 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1492 NULL, (gchar **)away_icon_xpm); | |
1493 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1494 gdk_pixmap_unref(pm); |
436 | 1495 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1496 { | |
1497 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1498 NULL, (gchar **)away_icon_xpm); |
436 | 1499 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1500 gdk_pixmap_unref(pm); |
436 | 1501 } |
1 | 1502 } else if (b->uc & UC_AOL) { |
1503 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1504 NULL, (gchar **)aol_icon_xpm); | |
1505 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1506 gdk_pixmap_unref(pm); |
436 | 1507 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1508 { | |
1509 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1510 NULL, (gchar **)aol_icon_xpm); |
436 | 1511 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1512 gdk_pixmap_unref(pm); |
436 | 1513 } |
1 | 1514 } else if (b->uc & UC_NORMAL) { |
1515 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1516 NULL, (gchar **)free_icon_xpm); | |
1517 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1518 gdk_pixmap_unref(pm); |
436 | 1519 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1520 { | |
1521 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1522 NULL, (gchar **)free_icon_xpm); |
436 | 1523 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1524 gdk_pixmap_unref(pm); |
436 | 1525 } |
1 | 1526 } else if (b->uc & UC_ADMIN) { |
1527 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1528 NULL, (gchar **)admin_icon_xpm); | |
1529 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1530 gdk_pixmap_unref(pm); |
436 | 1531 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1532 { | |
1533 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1534 NULL, (gchar **)admin_icon_xpm); |
436 | 1535 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1536 gdk_pixmap_unref(pm); |
436 | 1537 } |
1 | 1538 } else if (b->uc & UC_UNCONFIRMED) { |
1539 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1540 NULL, (gchar **)dt_icon_xpm); | |
1541 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1542 gdk_pixmap_unref(pm); |
436 | 1543 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1544 { | |
1545 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1546 NULL, (gchar **)dt_icon_xpm); |
436 | 1547 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1548 gdk_pixmap_unref(pm); |
436 | 1549 } |
1 | 1550 } else { |
1551 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1552 NULL, (gchar **)no_icon_xpm); | |
1553 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1554 gdk_pixmap_unref(pm); |
436 | 1555 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1556 { | |
1557 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1558 NULL, (gchar **)no_icon_xpm); |
436 | 1559 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1560 gdk_pixmap_unref(pm); |
436 | 1561 } |
1 | 1562 } |
1563 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1564 gtk_widget_show(b->pix); | |
1565 } | |
1566 | |
1567 | |
1568 | |
1569 } else { | |
59 | 1570 if (GTK_WIDGET_VISIBLE(b->item)) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1571 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1572 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1573 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1574 void (*function)(char *, void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1575 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1576 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1577 if (g->event == event_buddy_signoff && |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1578 g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1579 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1580 (*function)(b->name, g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1581 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1582 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1583 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1584 #endif |
1 | 1585 play_sound(BUDDY_LEAVE); |
1586 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1587 NULL, (gchar **)logout_icon_xpm); | |
1588 gtk_widget_hide(b->pix); | |
1589 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1590 if (display_options & OPT_DISP_SHOW_PIXMAPS) |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1591 gtk_widget_show(b->pix); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1592 gdk_pixmap_unref(pm); |
430 | 1593 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1594 NULL, (gchar **)logout_icon_xpm); | |
436 | 1595 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1596 BuddyTickerSetPixmap( b->name, pm, bm ); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1597 gdk_pixmap_unref(pm); |
1 | 1598 if (display_options & OPT_DISP_SHOW_LOGON) { |
1599 struct conversation *c = find_conversation(b->name); | |
1600 if (c) { | |
1601 char tmp[1024]; | |
1602 | |
1603 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1604 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged out%s%s.</B><BR><HR>"), b->name, |
1 | 1605 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1606 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1607 | |
1608 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1609 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1610 |
1611 } | |
1612 } | |
58 | 1613 b->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, b->name); |
436 | 1614 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1615 gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name); | |
1 | 1616 update_num_groups(); |
1617 update_show_idlepix(); | |
1618 } | |
1619 } | |
1620 setup_buddy_chats(); | |
1621 } | |
1622 | |
1623 | |
1624 static void move_blist_window(GtkWidget *w, GdkEventConfigure *e, void *dummy) | |
1625 { | |
1626 int x, y, width, height; | |
1627 int save = 0; | |
1628 gdk_window_get_position(blist->window, &x, &y); | |
1629 gdk_window_get_size(blist->window, &width, &height); | |
1630 | |
1631 if(e->send_event) { /* Is a position event */ | |
1632 if (blist_pos.x != x || blist_pos.y != y) | |
1633 save = 1; | |
1634 blist_pos.x = x; | |
1635 blist_pos.y = y; | |
1636 } else { /* Is a size event */ | |
1637 if (blist_pos.xoff != x || blist_pos.yoff != y || | |
1638 blist_pos.width != width || blist_pos.width != width) | |
1639 save = 1; | |
1640 | |
1641 blist_pos.width = width; | |
1642 blist_pos.height = height; | |
1643 blist_pos.xoff = x; | |
1644 blist_pos.yoff = y; | |
1645 } | |
1646 | |
1647 if (save) | |
1648 save_prefs(); | |
1649 | |
1650 } | |
1651 | |
1652 | |
1653 /******************************************************************* | |
1654 * | |
1655 * Helper funs for making the menu | |
1656 * | |
1657 *******************************************************************/ | |
1658 | |
1659 void gaim_seperator(GtkWidget *menu) | |
1660 { | |
1661 GtkWidget *sep, *menuitem; | |
1662 sep = gtk_hseparator_new(); | |
1663 menuitem = gtk_menu_item_new(); | |
1664 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1665 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1666 gtk_widget_set_sensitive(menuitem, FALSE); | |
1667 gtk_widget_show(menuitem); | |
1668 gtk_widget_show(sep); | |
1669 } | |
1670 | |
1671 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str, GtkSignalFunc sf) | |
1672 { | |
1673 GtkWidget *menuitem; | |
1674 menuitem = gtk_menu_item_new_with_label(str); | |
1675 if (menu) | |
1676 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1677 gtk_widget_show(menuitem); | |
1678 if (sf) | |
1679 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, NULL); | |
1680 return menuitem; | |
1681 } | |
1682 | |
714 | 1683 GtkWidget *gaim_new_item_with_pixmap(GtkWidget *menu, const char *str, char **xpm, GtkSignalFunc sf) |
1684 { | |
1685 GtkWidget *menuitem; | |
1686 GtkWidget *hbox; | |
1687 GtkWidget *label; | |
1688 GtkWidget *pixmap; | |
1689 GdkPixmap *pm; | |
1690 GdkBitmap *mask; | |
1691 | |
1692 menuitem = gtk_menu_item_new(); | |
1693 gtk_widget_show(menuitem); | |
1694 | |
1695 /* Create our container */ | |
718 | 1696 hbox = gtk_hbox_new(FALSE, 2); |
714 | 1697 |
1698 /* Create our pixmap and pack it */ | |
719
7e5523de52e2
[gaim-migrate @ 729]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
718
diff
changeset
|
1699 gtk_widget_realize(menu->parent); |
714 | 1700 pm = gdk_pixmap_create_from_xpm_d(menu->parent->window, &mask, NULL, xpm); |
1701 | |
1702 pixmap = gtk_pixmap_new(pm, mask); | |
1703 gtk_widget_show(pixmap); | |
1704 | |
718 | 1705 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, FALSE, 2); |
1706 | |
1707 /* Create our label and pack it */ | |
714 | 1708 |
718 | 1709 label = gtk_label_new(str); |
1710 gtk_widget_show(label); | |
1711 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1712 | |
714 | 1713 /* And finally, pack our box within our menu item */ |
1714 | |
1715 gtk_container_add(GTK_CONTAINER(menuitem), hbox); | |
1716 gtk_widget_show(hbox); | |
1717 | |
1718 if (menu) | |
1719 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1720 | |
1721 if (sf) | |
1722 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, NULL); | |
1723 return menuitem; | |
1724 } | |
1725 | |
1 | 1726 |
1727 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1728 void build_imchat_box(gboolean on) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1729 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1730 if (on) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1731 if (imchatbox) return; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1732 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1733 imbutton = gtk_button_new_with_label(_("IM")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1734 infobutton = gtk_button_new_with_label(_("Info")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1735 chatbutton = gtk_button_new_with_label(_("Chat")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1736 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1737 imchatbox = gtk_hbox_new(TRUE, 10); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1738 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1739 if (display_options & OPT_DISP_COOL_LOOK) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1740 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1741 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1742 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1743 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1744 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1745 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1746 /* Put the buttons in the hbox */ |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1747 gtk_widget_show(imbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1748 gtk_widget_show(chatbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1749 gtk_widget_show(infobutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1750 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1751 gtk_box_pack_start(GTK_BOX(imchatbox), imbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1752 gtk_box_pack_start(GTK_BOX(imchatbox), infobutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1753 gtk_box_pack_start(GTK_BOX(imchatbox), chatbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1754 gtk_container_border_width(GTK_CONTAINER(imchatbox), 10); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1755 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1756 gtk_signal_connect(GTK_OBJECT(imbutton), "clicked", GTK_SIGNAL_FUNC(show_im_dialog), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1757 gtk_signal_connect(GTK_OBJECT(infobutton), "clicked", GTK_SIGNAL_FUNC(info_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1758 gtk_signal_connect(GTK_OBJECT(chatbutton), "clicked", GTK_SIGNAL_FUNC(chat_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1759 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1760 gtk_tooltips_set_tip(tips,infobutton, _("Information on selected Buddy"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1761 gtk_tooltips_set_tip(tips,imbutton, _("Send Instant Message"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1762 gtk_tooltips_set_tip(tips,chatbutton, _("Start/join a Buddy Chat"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1763 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1764 gtk_box_pack_start(GTK_BOX(buddypane), imchatbox, FALSE, FALSE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1765 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1766 gtk_widget_show(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1767 } else { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1768 if (imchatbox) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1769 gtk_widget_destroy(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1770 imchatbox = NULL; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1771 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1772 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1773 |
1 | 1774 |
1775 | |
1776 void show_buddy_list() | |
1777 { | |
1778 | |
1779 /* Build the buddy list, based on *config */ | |
1780 | |
1781 GtkWidget *sw; | |
1782 GtkWidget *menu; | |
1783 GtkWidget *findmenu; | |
1784 GtkWidget *setmenu; | |
1785 GtkWidget *menubar; | |
1786 GtkWidget *vbox; | |
1787 GtkWidget *menuitem; | |
1788 GtkWidget *notebook; | |
1789 GtkWidget *label; | |
1790 GtkWidget *bbox; | |
1791 GtkWidget *tbox; | |
1792 | |
1793 | |
1794 #ifdef USE_APPLET | |
1795 blist = gtk_window_new(GTK_WINDOW_DIALOG); | |
1796 #else | |
1797 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1798 #endif | |
1799 | |
1800 gtk_widget_realize(blist); | |
1801 aol_icon(blist->window); | |
1802 | |
1803 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); | |
1804 | |
1805 menubar = gtk_menu_bar_new(); | |
1806 | |
1807 menu = gtk_menu_new(); | |
1808 | |
1809 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1810 menuitem = gaim_new_item(NULL, _("File"), NULL); |
1 | 1811 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1812 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1813 | |
714 | 1814 // gaim_new_item(menu, _("Add A Buddy"), GTK_SIGNAL_FUNC(add_buddy_callback)); |
1815 gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, GTK_SIGNAL_FUNC(add_buddy_callback)); | |
718 | 1816 gaim_new_item_with_pixmap(menu, _("Join A Chat"), add_small_xpm, GTK_SIGNAL_FUNC(chat_callback)); |
1 | 1817 gaim_seperator(menu); |
718 | 1818 gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, GTK_SIGNAL_FUNC(import_callback)); |
733 | 1819 gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,GTK_SIGNAL_FUNC(export_callback)); |
1 | 1820 if (!(general_options & OPT_GEN_REGISTERED)) |
1821 { | |
1822 gaim_seperator(menu); | |
718 | 1823 gaim_new_item_with_pixmap(menu, _("Register"), add_small_xpm, GTK_SIGNAL_FUNC(gaimreg_callback)); |
1 | 1824 } |
1825 gaim_seperator(menu); | |
733 | 1826 gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, GTK_SIGNAL_FUNC(signoff)); |
1 | 1827 |
1828 #ifndef USE_APPLET | |
727 | 1829 gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm, GTK_SIGNAL_FUNC(do_quit)); |
1 | 1830 #else |
727 | 1831 gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm, GTK_SIGNAL_FUNC(applet_destroy_buddy)); |
1 | 1832 #endif |
1833 | |
1834 menu = gtk_menu_new(); | |
1835 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1836 menuitem = gaim_new_item(NULL, _("Tools"), NULL); |
1 | 1837 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1838 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1839 | |
1840 awaymenu = gtk_menu_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1841 menuitem = gaim_new_item(menu, _("Away"), NULL); |
1 | 1842 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu); |
1843 do_away_menu(); | |
1844 | |
1845 bpmenu = gtk_menu_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1846 menuitem = gaim_new_item(menu, _("Buddy Pounce"), NULL); |
1 | 1847 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); |
1848 do_bp_menu(); | |
1849 | |
1850 gaim_seperator(menu); | |
1851 | |
1852 findmenu = gtk_menu_new(); | |
1853 gtk_widget_show(findmenu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1854 menuitem = gaim_new_item(menu, _("Search for Buddy"), NULL); |
1 | 1855 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), findmenu); |
1856 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1857 menuitem = gtk_menu_item_new_with_label(_("by Email")); |
1 | 1858 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1859 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_email), NULL); | |
1860 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1861 menuitem = gtk_menu_item_new_with_label(_("by Dir Info")); |
1 | 1862 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1863 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_info), NULL); | |
1864 gtk_widget_show(menuitem); | |
1865 | |
1866 setmenu = gtk_menu_new(); | |
1867 gtk_widget_show(setmenu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1868 menuitem = gaim_new_item(menu, _("Settings"), NULL); |
1 | 1869 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), setmenu); |
1870 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1871 menuitem = gtk_menu_item_new_with_label(_("User Info")); |
1 | 1872 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1873 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_info), NULL); | |
1874 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1875 menuitem = gtk_menu_item_new_with_label(_("Directory Info")); |
1 | 1876 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1877 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_dir), NULL); | |
1878 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1879 menuitem = gtk_menu_item_new_with_label(_("Change Password")); |
146 | 1880 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1881 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); | |
1882 gtk_widget_show(menuitem); | |
1 | 1883 gaim_seperator(menu); |
1884 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1885 gaim_new_item(menu, _("Preferences"), GTK_SIGNAL_FUNC(show_prefs)); |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1886 |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1887 #ifdef GAIM_PLUGINS |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1888 gaim_new_item(menu, _("Plugins"), GTK_SIGNAL_FUNC(show_plugins)); |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1889 #endif |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1890 |
1 | 1891 menu = gtk_menu_new(); |
1892 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1893 menuitem = gaim_new_item(NULL, _("Help"), NULL); |
1 | 1894 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1895 gtk_menu_item_right_justify(GTK_MENU_ITEM(menuitem)); | |
1896 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1897 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1898 gaim_new_item(menu, _("About"), show_about); |
1 | 1899 |
1900 gtk_widget_show(menubar); | |
1901 | |
1902 vbox = gtk_vbox_new(FALSE, 10); | |
1903 | |
1904 notebook = gtk_notebook_new(); | |
1905 | |
1906 | |
1907 | |
1908 | |
1909 /* Do buddy list stuff */ | |
1910 | |
1911 buddypane = gtk_vbox_new(FALSE, 0); | |
1912 | |
1913 buddies = gtk_tree_new(); | |
1914 sw = gtk_scrolled_window_new(NULL, NULL); | |
1915 | |
1916 tips = gtk_tooltips_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1917 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips); |
1 | 1918 |
1919 /* Now the buddy list */ | |
1920 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw),buddies); | |
1921 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
1922 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | |
1923 gtk_widget_set_usize(sw,200,200); | |
1924 gtk_widget_show(buddies); | |
1925 gtk_widget_show(sw); | |
1926 | |
1927 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0); | |
1928 gtk_widget_show(buddypane); | |
1929 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1930 if (!(display_options & OPT_DISP_NO_BUTTONS)) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1931 build_imchat_box(TRUE); |
1 | 1932 |
1933 | |
1934 /* Swing the edit buddy */ | |
1935 editpane = gtk_vbox_new(FALSE, 0); | |
1936 | |
1937 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1938 addbutton = gtk_button_new_with_label(_("Add")); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1939 groupbutton = gtk_button_new_with_label(_("Group")); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1940 rembutton = gtk_button_new_with_label(_("Remove")); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1941 |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1942 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1943 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1944 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1945 gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1946 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1947 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1948 |
1 | 1949 edittree = gtk_ctree_new(1, 0); |
1950 gtk_ctree_set_line_style (GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID); | |
1951 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE); | |
1952 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE); | |
1953 | |
1954 gtk_ctree_set_drag_compare_func (GTK_CTREE(edittree), | |
1955 (GtkCTreeCompareDragFunc)edit_drag_compare_func); | |
1956 | |
1957 | |
1958 gtk_signal_connect_after (GTK_OBJECT (edittree), "tree_move", | |
1959 GTK_SIGNAL_FUNC (edit_tree_move), NULL); | |
1960 | |
1961 | |
1962 bbox = gtk_hbox_new(TRUE, 10); | |
1963 tbox = gtk_scrolled_window_new(NULL, NULL); | |
1964 /* Put the buttons in the box */ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1965 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1966 gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1967 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0); |
1 | 1968 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1969 gtk_tooltips_set_tip(tips, addbutton, _("Add a new Buddy"), "Penguin"); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1970 gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin"); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1971 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy"), "Penguin"); |
1 | 1972 |
1973 /* And the boxes in the box */ | |
1974 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 5); | |
1975 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 5); | |
1976 | |
1977 /* Handle closes right */ | |
1978 | |
1979 | |
1980 | |
1981 /* Finish up */ | |
1982 gtk_widget_show(addbutton); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1983 gtk_widget_show(groupbutton); |
1 | 1984 gtk_widget_show(rembutton); |
1985 gtk_widget_show(edittree); | |
1986 gtk_widget_show(tbox); | |
1987 gtk_widget_show(bbox); | |
1988 gtk_widget_show(editpane); | |
1989 | |
1990 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1991 |
703
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1992 update_button_pix(); |
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1993 |
1 | 1994 |
1995 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1996 label = gtk_label_new(_("Online")); |
1 | 1997 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1998 label = gtk_label_new(_("Edit Buddies")); |
1 | 1999 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label); |
2000 | |
2001 gtk_widget_show_all(notebook); | |
2002 | |
2003 /* Pack things in the vbox */ | |
2004 gtk_widget_show(vbox); | |
2005 | |
2006 | |
2007 gtk_widget_show(notebook); | |
2008 | |
2009 /* Enable buttons */ | |
2010 | |
2011 gtk_signal_connect(GTK_OBJECT(rembutton), "clicked", GTK_SIGNAL_FUNC(do_del_buddy), edittree); | |
2012 gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2013 gtk_signal_connect(GTK_OBJECT(groupbutton), "clicked", GTK_SIGNAL_FUNC(add_group_callback), NULL); |
1 | 2014 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); |
2015 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
2016 | |
2017 gtk_container_add(GTK_CONTAINER(blist), vbox); | |
2018 | |
2019 #ifndef USE_APPLET | |
2020 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(do_quit), blist); | |
2021 #else | |
2022 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(applet_destroy_buddy), NULL); | |
2023 #endif | |
2024 | |
2025 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window), NULL); | |
2026 | |
2027 | |
2028 | |
2029 /* The edit tree */ | |
2030 gtk_container_add(GTK_CONTAINER(tbox), edittree); | |
2031 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), | |
2032 GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC); | |
2033 | |
2034 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2035 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List")); |
1 | 2036 |
2037 if (general_options & OPT_GEN_SAVED_WINDOWS) { | |
2038 if (blist_pos.width != 0) { /* Sanity check! */ | |
2039 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff); | |
2040 gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height); | |
2041 } | |
2042 } | |
2043 } | |
2044 | |
2045 void refresh_buddy_window() | |
2046 { | |
2047 build_edit_tree(); | |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
2048 build_permit_tree(); |
1 | 2049 |
2050 update_button_pix(); | |
2051 gtk_widget_show(blist); | |
2052 } | |
2053 |