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