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