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