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