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